From 4d423102c14de9e9328f1852db539d9561a3cad9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Jan 2025 13:10:39 +0000 Subject: [chore]: Bump github.com/gin-contrib/gzip from 1.0.1 to 1.1.0 (#3639) Bumps [github.com/gin-contrib/gzip](https://github.com/gin-contrib/gzip) from 1.0.1 to 1.1.0. - [Release notes](https://github.com/gin-contrib/gzip/releases) - [Changelog](https://github.com/gin-contrib/gzip/blob/master/.goreleaser.yaml) - [Commits](https://github.com/gin-contrib/gzip/compare/v1.0.1...v1.1.0) --- updated-dependencies: - dependency-name: github.com/gin-contrib/gzip dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 22 +- go.sum | 49 +- vendor/github.com/bytedance/sonic/.gitignore | 5 +- vendor/github.com/bytedance/sonic/README.md | 48 +- vendor/github.com/bytedance/sonic/README_ZH_CN.md | 50 +- vendor/github.com/bytedance/sonic/api.go | 33 + vendor/github.com/bytedance/sonic/ast/api.go | 6 +- .../github.com/bytedance/sonic/ast/api_compat.go | 4 +- vendor/github.com/bytedance/sonic/ast/b64_amd64.go | 31 - .../github.com/bytedance/sonic/ast/b64_compat.go | 31 - vendor/github.com/bytedance/sonic/ast/buffer.go | 89 +- vendor/github.com/bytedance/sonic/ast/decode.go | 88 +- vendor/github.com/bytedance/sonic/ast/encode.go | 55 +- vendor/github.com/bytedance/sonic/ast/error.go | 6 +- vendor/github.com/bytedance/sonic/ast/iterator.go | 21 +- vendor/github.com/bytedance/sonic/ast/node.go | 303 +- vendor/github.com/bytedance/sonic/ast/parser.go | 142 +- vendor/github.com/bytedance/sonic/ast/search.go | 31 +- vendor/github.com/bytedance/sonic/ast/stubs.go | 142 + .../github.com/bytedance/sonic/ast/stubs_go115.go | 55 - .../github.com/bytedance/sonic/ast/stubs_go120.go | 55 - vendor/github.com/bytedance/sonic/ast/visitor.go | 45 +- vendor/github.com/bytedance/sonic/compat.go | 4 +- .../bytedance/sonic/decoder/decoder_amd64.go | 68 - .../bytedance/sonic/decoder/decoder_compat.go | 6 +- .../bytedance/sonic/decoder/decoder_native.go | 71 + .../bytedance/sonic/encoder/encoder_amd64.go | 117 - .../bytedance/sonic/encoder/encoder_compat.go | 4 +- .../bytedance/sonic/encoder/encoder_native.go | 120 + vendor/github.com/bytedance/sonic/go.work.sum | 1 + .../bytedance/sonic/internal/base64/b64_amd64.go | 46 + .../bytedance/sonic/internal/base64/b64_compat.go | 44 + .../bytedance/sonic/internal/cpu/features.go | 4 +- .../sonic/internal/decoder/api/decoder.go | 173 + .../sonic/internal/decoder/api/decoder_amd64.go | 38 + .../sonic/internal/decoder/api/decoder_arm64.go | 38 + .../bytedance/sonic/internal/decoder/api/stream.go | 248 + .../bytedance/sonic/internal/decoder/asm.s | 0 .../internal/decoder/asm_stubs_amd64_go116.go | 130 - .../internal/decoder/asm_stubs_amd64_go117.go | 126 - .../internal/decoder/asm_stubs_amd64_go121.go | 132 - .../internal/decoder/assembler_regabi_amd64.go | 1930 --- .../internal/decoder/assembler_stkabi_amd64.go | 1950 --- .../bytedance/sonic/internal/decoder/compiler.go | 1158 -- .../sonic/internal/decoder/consts/option.go | 36 + .../bytedance/sonic/internal/decoder/debug.go | 70 - .../bytedance/sonic/internal/decoder/decoder.go | 255 - .../bytedance/sonic/internal/decoder/errors.go | 191 - .../sonic/internal/decoder/errors/errors.go | 191 + .../sonic/internal/decoder/generic_regabi_amd64.go | 729 - .../internal/decoder/generic_regabi_amd64_test.s | 37 - .../sonic/internal/decoder/generic_stkabi_amd64.go | 733 - .../internal/decoder/generic_stkabi_amd64_test.s | 37 - .../bytedance/sonic/internal/decoder/jitdec/asm.s | 0 .../decoder/jitdec/asm_stubs_amd64_go117.go | 126 + .../decoder/jitdec/asm_stubs_amd64_go121.go | 132 + .../decoder/jitdec/assembler_regabi_amd64.go | 1971 +++ .../sonic/internal/decoder/jitdec/compiler.go | 1213 ++ .../sonic/internal/decoder/jitdec/debug.go | 70 + .../sonic/internal/decoder/jitdec/decoder.go | 140 + .../decoder/jitdec/generic_regabi_amd64.go | 729 + .../decoder/jitdec/generic_regabi_amd64_test.s | 37 + .../sonic/internal/decoder/jitdec/pools.go | 145 + .../sonic/internal/decoder/jitdec/primitives.go | 58 + .../sonic/internal/decoder/jitdec/stubs_go116.go | 106 + .../sonic/internal/decoder/jitdec/stubs_go120.go | 106 + .../sonic/internal/decoder/jitdec/types.go | 58 + .../sonic/internal/decoder/jitdec/utils.go | 39 + .../internal/decoder/optdec/compile_struct.go | 174 + .../sonic/internal/decoder/optdec/compiler.go | 449 + .../sonic/internal/decoder/optdec/const.go | 60 + .../sonic/internal/decoder/optdec/context.go | 3 + .../sonic/internal/decoder/optdec/decoder.go | 160 + .../sonic/internal/decoder/optdec/errors.go | 73 + .../sonic/internal/decoder/optdec/functor.go | 281 + .../sonic/internal/decoder/optdec/helper.go | 110 + .../sonic/internal/decoder/optdec/interface.go | 169 + .../bytedance/sonic/internal/decoder/optdec/map.go | 430 + .../sonic/internal/decoder/optdec/native.go | 269 + .../sonic/internal/decoder/optdec/node.go | 1278 ++ .../sonic/internal/decoder/optdec/slice.go | 224 + .../sonic/internal/decoder/optdec/stringopts.go | 360 + .../sonic/internal/decoder/optdec/structs.go | 61 + .../sonic/internal/decoder/optdec/types.go | 60 + .../bytedance/sonic/internal/decoder/pools.go | 143 - .../bytedance/sonic/internal/decoder/primitives.go | 44 - .../bytedance/sonic/internal/decoder/stream.go | 257 - .../sonic/internal/decoder/stubs_go116.go | 111 - .../sonic/internal/decoder/stubs_go120.go | 111 - .../bytedance/sonic/internal/decoder/types.go | 58 - .../bytedance/sonic/internal/decoder/utils.go | 39 - .../sonic/internal/encoder/alg/mapiter.go | 206 + .../bytedance/sonic/internal/encoder/alg/opts.go | 31 + .../sonic/internal/encoder/alg/primitives.go | 95 + .../bytedance/sonic/internal/encoder/alg/sort.go | 206 + .../bytedance/sonic/internal/encoder/alg/spec.go | 198 + .../sonic/internal/encoder/alg/spec_compat.go | 148 + .../bytedance/sonic/internal/encoder/asm.s | 0 .../internal/encoder/asm_stubs_amd64_go116.go | 51 - .../internal/encoder/asm_stubs_amd64_go117.go | 51 - .../internal/encoder/asm_stubs_amd64_go121.go | 50 - .../internal/encoder/assembler_regabi_amd64.go | 1176 -- .../internal/encoder/assembler_stkabi_amd64.go | 1175 -- .../bytedance/sonic/internal/encoder/compiler.go | 1517 +- .../sonic/internal/encoder/debug_go116.go | 66 - .../sonic/internal/encoder/debug_go117.go | 205 - .../sonic/internal/encoder/encode_norace.go | 24 + .../sonic/internal/encoder/encode_race.go | 54 + .../bytedance/sonic/internal/encoder/encoder.go | 171 +- .../bytedance/sonic/internal/encoder/errors.go | 65 - .../bytedance/sonic/internal/encoder/ir/op.go | 473 + .../bytedance/sonic/internal/encoder/mapiter.go | 199 - .../bytedance/sonic/internal/encoder/pools.go | 193 - .../sonic/internal/encoder/pools_amd64.go | 97 + .../sonic/internal/encoder/pools_compt.go | 24 + .../bytedance/sonic/internal/encoder/primitives.go | 167 - .../bytedance/sonic/internal/encoder/sort.go | 206 - .../bytedance/sonic/internal/encoder/stream.go | 28 +- .../sonic/internal/encoder/stubs_go116.go | 61 - .../sonic/internal/encoder/stubs_go117.go | 62 - .../sonic/internal/encoder/stubs_go120.go | 62 - .../sonic/internal/encoder/stubs_go121.go | 62 - .../bytedance/sonic/internal/encoder/types.go | 47 - .../bytedance/sonic/internal/encoder/utils.go | 52 - .../bytedance/sonic/internal/encoder/vars/cache.go | 48 + .../bytedance/sonic/internal/encoder/vars/const.go | 42 + .../sonic/internal/encoder/vars/errors.go | 65 + .../bytedance/sonic/internal/encoder/vars/stack.go | 146 + .../bytedance/sonic/internal/encoder/vars/types.go | 47 + .../bytedance/sonic/internal/encoder/vm/stbus.go | 45 + .../bytedance/sonic/internal/encoder/vm/vm.go | 374 + .../internal/encoder/x86/asm_stubs_amd64_go117.go | 53 + .../internal/encoder/x86/asm_stubs_amd64_go121.go | 52 + .../internal/encoder/x86/assembler_regabi_amd64.go | 1195 ++ .../sonic/internal/encoder/x86/debug_go116.go | 66 + .../sonic/internal/encoder/x86/debug_go117.go | 201 + .../bytedance/sonic/internal/encoder/x86/stbus.go | 54 + .../bytedance/sonic/internal/envs/decode.go | 24 + .../bytedance/sonic/internal/jit/runtime.go | 2 +- .../bytedance/sonic/internal/native/avx/f32toa.go | 36 - .../sonic/internal/native/avx/f32toa_subr.go | 44 - .../sonic/internal/native/avx/f32toa_text_amd64.go | 964 -- .../bytedance/sonic/internal/native/avx/f64toa.go | 37 - .../sonic/internal/native/avx/f64toa_subr.go | 46 - .../sonic/internal/native/avx/f64toa_text_amd64.go | 2402 --- .../sonic/internal/native/avx/get_by_path.go | 37 - .../sonic/internal/native/avx/get_by_path_subr.go | 45 - .../internal/native/avx/get_by_path_text_amd64.go | 6049 -------- .../sonic/internal/native/avx/html_escape.go | 36 - .../sonic/internal/native/avx/html_escape_subr.go | 45 - .../internal/native/avx/html_escape_text_amd64.go | 620 - .../bytedance/sonic/internal/native/avx/i64toa.go | 37 - .../sonic/internal/native/avx/i64toa_subr.go | 47 - .../sonic/internal/native/avx/i64toa_text_amd64.go | 639 - .../bytedance/sonic/internal/native/avx/lspace.go | 36 - .../sonic/internal/native/avx/lspace_subr.go | 37 - .../sonic/internal/native/avx/lspace_text_amd64.go | 44 - .../sonic/internal/native/avx/native_export.go | 47 - .../bytedance/sonic/internal/native/avx/quote.go | 35 - .../sonic/internal/native/avx/quote_subr.go | 46 - .../sonic/internal/native/avx/quote_text_amd64.go | 1085 -- .../sonic/internal/native/avx/skip_array.go | 37 - .../sonic/internal/native/avx/skip_array_subr.go | 46 - .../internal/native/avx/skip_array_text_amd64.go | 2854 ---- .../sonic/internal/native/avx/skip_number.go | 36 - .../sonic/internal/native/avx/skip_number_subr.go | 46 - .../internal/native/avx/skip_number_text_amd64.go | 394 - .../sonic/internal/native/avx/skip_object.go | 37 - .../sonic/internal/native/avx/skip_object_subr.go | 46 - .../internal/native/avx/skip_object_text_amd64.go | 2854 ---- .../sonic/internal/native/avx/skip_one.go | 37 - .../sonic/internal/native/avx/skip_one_fast.go | 37 - .../internal/native/avx/skip_one_fast_subr.go | 45 - .../native/avx/skip_one_fast_text_amd64.go | 945 -- .../sonic/internal/native/avx/skip_one_subr.go | 46 - .../internal/native/avx/skip_one_text_amd64.go | 2830 ---- .../bytedance/sonic/internal/native/avx/u64toa.go | 36 - .../sonic/internal/native/avx/u64toa_subr.go | 39 - .../sonic/internal/native/avx/u64toa_text_amd64.go | 371 - .../bytedance/sonic/internal/native/avx/unquote.go | 36 - .../sonic/internal/native/avx/unquote_subr.go | 46 - .../internal/native/avx/unquote_text_amd64.go | 639 - .../sonic/internal/native/avx/validate_one.go | 37 - .../sonic/internal/native/avx/validate_one_subr.go | 46 - .../internal/native/avx/validate_one_text_amd64.go | 2851 ---- .../sonic/internal/native/avx/validate_utf8.go | 39 - .../internal/native/avx/validate_utf8_fast.go | 36 - .../internal/native/avx/validate_utf8_fast_subr.go | 41 - .../native/avx/validate_utf8_fast_text_amd64.go | 156 - .../internal/native/avx/validate_utf8_subr.go | 44 - .../native/avx/validate_utf8_text_amd64.go | 191 - .../bytedance/sonic/internal/native/avx/value.go | 33 - .../sonic/internal/native/avx/value_subr.go | 46 - .../sonic/internal/native/avx/value_text_amd64.go | 5639 ------- .../bytedance/sonic/internal/native/avx/vnumber.go | 33 - .../sonic/internal/native/avx/vnumber_subr.go | 46 - .../internal/native/avx/vnumber_text_amd64.go | 4387 ------ .../bytedance/sonic/internal/native/avx/vsigned.go | 33 - .../sonic/internal/native/avx/vsigned_subr.go | 50 - .../internal/native/avx/vsigned_text_amd64.go | 112 - .../bytedance/sonic/internal/native/avx/vstring.go | 33 - .../sonic/internal/native/avx/vstring_subr.go | 46 - .../internal/native/avx/vstring_text_amd64.go | 643 - .../sonic/internal/native/avx/vunsigned.go | 33 - .../sonic/internal/native/avx/vunsigned_subr.go | 43 - .../internal/native/avx/vunsigned_text_amd64.go | 108 - .../bytedance/sonic/internal/native/avx2/f32toa.go | 7 +- .../sonic/internal/native/avx2/f32toa_subr.go | 36 +- .../internal/native/avx2/f32toa_text_amd64.go | 2001 +-- .../bytedance/sonic/internal/native/avx2/f64toa.go | 2 - .../sonic/internal/native/avx2/f64toa_subr.go | 38 +- .../internal/native/avx2/f64toa_text_amd64.go | 4867 +++--- .../sonic/internal/native/avx2/get_by_path.go | 2 - .../sonic/internal/native/avx2/get_by_path_subr.go | 35 +- .../internal/native/avx2/get_by_path_text_amd64.go | 12634 ++++++++------- .../sonic/internal/native/avx2/html_escape.go | 2 - .../sonic/internal/native/avx2/html_escape_subr.go | 32 +- .../internal/native/avx2/html_escape_text_amd64.go | 1062 +- .../bytedance/sonic/internal/native/avx2/i64toa.go | 2 - .../sonic/internal/native/avx2/i64toa_subr.go | 36 +- .../internal/native/avx2/i64toa_text_amd64.go | 1154 +- .../sonic/internal/native/avx2/lookup_small_key.go | 37 + .../internal/native/avx2/lookup_small_key_subr.go | 45 + .../native/avx2/lookup_small_key_text_amd64.go | 216 + .../bytedance/sonic/internal/native/avx2/lspace.go | 3 +- .../sonic/internal/native/avx2/lspace_subr.go | 17 +- .../internal/native/avx2/lspace_text_amd64.go | 131 +- .../sonic/internal/native/avx2/native_export.go | 6 +- .../internal/native/avx2/parse_with_padding.go | 36 + .../native/avx2/parse_with_padding_subr.go | 46 + .../native/avx2/parse_with_padding_text_amd64.go | 15284 +++++++++++++++++++ .../bytedance/sonic/internal/native/avx2/quote.go | 2 - .../sonic/internal/native/avx2/quote_subr.go | 36 +- .../sonic/internal/native/avx2/quote_text_amd64.go | 1643 +- .../sonic/internal/native/avx2/skip_array.go | 2 - .../sonic/internal/native/avx2/skip_array_subr.go | 38 +- .../internal/native/avx2/skip_array_text_amd64.go | 7394 +++++---- .../sonic/internal/native/avx2/skip_number.go | 2 - .../sonic/internal/native/avx2/skip_number_subr.go | 34 +- .../internal/native/avx2/skip_number_text_amd64.go | 943 +- .../sonic/internal/native/avx2/skip_object.go | 2 - .../sonic/internal/native/avx2/skip_object_subr.go | 38 +- .../internal/native/avx2/skip_object_text_amd64.go | 7394 +++++---- .../sonic/internal/native/avx2/skip_one.go | 2 - .../sonic/internal/native/avx2/skip_one_fast.go | 2 - .../internal/native/avx2/skip_one_fast_subr.go | 33 +- .../native/avx2/skip_one_fast_text_amd64.go | 1675 +- .../sonic/internal/native/avx2/skip_one_subr.go | 38 +- .../internal/native/avx2/skip_one_text_amd64.go | 6691 ++++---- .../bytedance/sonic/internal/native/avx2/u64toa.go | 2 - .../sonic/internal/native/avx2/u64toa_subr.go | 20 +- .../internal/native/avx2/u64toa_text_amd64.go | 621 +- .../sonic/internal/native/avx2/unquote.go | 2 - .../sonic/internal/native/avx2/unquote_subr.go | 36 +- .../internal/native/avx2/unquote_text_amd64.go | 1218 +- .../sonic/internal/native/avx2/validate_one.go | 2 - .../internal/native/avx2/validate_one_subr.go | 38 +- .../native/avx2/validate_one_text_amd64.go | 7401 +++++---- .../sonic/internal/native/avx2/validate_utf8.go | 2 - .../internal/native/avx2/validate_utf8_fast.go | 2 - .../native/avx2/validate_utf8_fast_subr.go | 24 +- .../native/avx2/validate_utf8_fast_text_amd64.go | 851 +- .../internal/native/avx2/validate_utf8_subr.go | 30 +- .../native/avx2/validate_utf8_text_amd64.go | 220 +- .../sonic/internal/native/avx2/value_subr.go | 38 +- .../sonic/internal/native/avx2/value_text_amd64.go | 11408 +++++++------- .../sonic/internal/native/avx2/vnumber_subr.go | 36 +- .../internal/native/avx2/vnumber_text_amd64.go | 8670 +++++------ .../sonic/internal/native/avx2/vsigned_subr.go | 42 +- .../internal/native/avx2/vsigned_text_amd64.go | 194 +- .../sonic/internal/native/avx2/vstring_subr.go | 36 +- .../internal/native/avx2/vstring_text_amd64.go | 1036 +- .../sonic/internal/native/avx2/vunsigned_subr.go | 44 +- .../internal/native/avx2/vunsigned_text_amd64.go | 211 +- .../sonic/internal/native/dispatch_amd64.go | 75 +- .../sonic/internal/native/dispatch_arm64.go | 15 + .../bytedance/sonic/internal/native/f32toa.tmpl | 7 +- .../bytedance/sonic/internal/native/f64toa.tmpl | 2 - .../sonic/internal/native/fastfloat_test.tmpl | 2 - .../sonic/internal/native/fastint_test.tmpl | 2 - .../sonic/internal/native/get_by_path.tmpl | 2 - .../sonic/internal/native/html_escape.tmpl | 2 - .../bytedance/sonic/internal/native/i64toa.tmpl | 2 - .../sonic/internal/native/lookup_small_key.tmpl | 37 + .../bytedance/sonic/internal/native/lspace.tmpl | 3 +- .../sonic/internal/native/native_export.tmpl | 6 +- .../sonic/internal/native/native_test.tmpl | 4 +- .../sonic/internal/native/neon/f32toa_arm64.go | 2 - .../sonic/internal/native/neon/f32toa_arm64.s | 2 +- .../sonic/internal/native/neon/f64toa_arm64.go | 2 - .../sonic/internal/native/neon/f64toa_arm64.s | 2 +- .../internal/native/neon/get_by_path_arm64.go | 2 - .../internal/native/neon/html_escape_arm64.go | 2 - .../sonic/internal/native/neon/i64toa_arm64.go | 2 - .../internal/native/neon/lookup_small_key_arm64.go | 31 + .../internal/native/neon/lookup_small_key_arm64.s | 354 + .../native/neon/lookup_small_key_subr_arm64.go | 25 + .../sonic/internal/native/neon/lspace_arm64.go | 2 - .../internal/native/neon/native_export_arm64.go | 2 + .../native/neon/parse_with_padding_arm64.go | 30 + .../native/neon/parse_with_padding_arm64.s | 14122 +++++++++++++++++ .../native/neon/parse_with_padding_subr_arm64.go | 25 + .../sonic/internal/native/neon/quote_arm64.go | 2 - .../sonic/internal/native/neon/skip_array_arm64.go | 2 - .../sonic/internal/native/neon/skip_array_arm64.s | 5323 ++++--- .../internal/native/neon/skip_array_subr_arm64.go | 2 +- .../internal/native/neon/skip_number_arm64.go | 2 - .../internal/native/neon/skip_object_arm64.go | 2 - .../sonic/internal/native/neon/skip_object_arm64.s | 5323 ++++--- .../internal/native/neon/skip_object_subr_arm64.go | 2 +- .../sonic/internal/native/neon/skip_one_arm64.go | 2 - .../sonic/internal/native/neon/skip_one_arm64.s | 2278 ++- .../internal/native/neon/skip_one_fast_arm64.go | 2 - .../internal/native/neon/skip_one_subr_arm64.go | 2 +- .../sonic/internal/native/neon/u64toa_arm64.go | 2 - .../sonic/internal/native/neon/unquote_arm64.go | 2 - .../internal/native/neon/validate_one_arm64.go | 2 - .../internal/native/neon/validate_one_arm64.s | 5323 ++++--- .../native/neon/validate_one_subr_arm64.go | 2 +- .../internal/native/neon/validate_utf8_arm64.go | 2 - .../native/neon/validate_utf8_fast_arm64.go | 2 - .../sonic/internal/native/parse_with_padding.tmpl | 36 + .../bytedance/sonic/internal/native/quote.tmpl | 2 - .../sonic/internal/native/recover_test.tmpl | 59 +- .../sonic/internal/native/skip_array.tmpl | 2 - .../sonic/internal/native/skip_number.tmpl | 2 - .../sonic/internal/native/skip_object.tmpl | 2 - .../bytedance/sonic/internal/native/skip_one.tmpl | 2 - .../sonic/internal/native/skip_one_fast.tmpl | 2 - .../bytedance/sonic/internal/native/sse/f32toa.go | 7 +- .../sonic/internal/native/sse/f32toa_subr.go | 34 +- .../sonic/internal/native/sse/f32toa_text_amd64.go | 1964 +-- .../bytedance/sonic/internal/native/sse/f64toa.go | 2 - .../sonic/internal/native/sse/f64toa_subr.go | 36 +- .../sonic/internal/native/sse/f64toa_text_amd64.go | 4822 +++--- .../sonic/internal/native/sse/get_by_path.go | 2 - .../sonic/internal/native/sse/get_by_path_subr.go | 38 +- .../internal/native/sse/get_by_path_text_amd64.go | 12619 ++++++++------- .../sonic/internal/native/sse/html_escape.go | 2 - .../sonic/internal/native/sse/html_escape_subr.go | 34 +- .../internal/native/sse/html_escape_text_amd64.go | 715 +- .../bytedance/sonic/internal/native/sse/i64toa.go | 2 - .../sonic/internal/native/sse/i64toa_subr.go | 36 +- .../sonic/internal/native/sse/i64toa_text_amd64.go | 1182 +- .../sonic/internal/native/sse/lookup_small_key.go | 37 + .../internal/native/sse/lookup_small_key_subr.go | 45 + .../native/sse/lookup_small_key_text_amd64.go | 239 + .../bytedance/sonic/internal/native/sse/lspace.go | 3 +- .../sonic/internal/native/sse/lspace_subr.go | 12 +- .../sonic/internal/native/sse/lspace_text_amd64.go | 57 +- .../sonic/internal/native/sse/native_export.go | 6 +- .../internal/native/sse/parse_with_padding.go | 36 + .../internal/native/sse/parse_with_padding_subr.go | 46 + .../native/sse/parse_with_padding_text_amd64.go | 15013 ++++++++++++++++++ .../bytedance/sonic/internal/native/sse/quote.go | 2 - .../sonic/internal/native/sse/quote_subr.go | 36 +- .../sonic/internal/native/sse/quote_text_amd64.go | 1141 +- .../sonic/internal/native/sse/skip_array.go | 2 - .../sonic/internal/native/sse/skip_array_subr.go | 38 +- .../internal/native/sse/skip_array_text_amd64.go | 6980 +++++---- .../sonic/internal/native/sse/skip_number.go | 2 - .../sonic/internal/native/sse/skip_number_subr.go | 34 +- .../internal/native/sse/skip_number_text_amd64.go | 689 +- .../sonic/internal/native/sse/skip_object.go | 2 - .../sonic/internal/native/sse/skip_object_subr.go | 38 +- .../internal/native/sse/skip_object_text_amd64.go | 6980 +++++---- .../sonic/internal/native/sse/skip_one.go | 2 - .../sonic/internal/native/sse/skip_one_fast.go | 2 - .../internal/native/sse/skip_one_fast_subr.go | 34 +- .../native/sse/skip_one_fast_text_amd64.go | 2008 ++- .../sonic/internal/native/sse/skip_one_subr.go | 38 +- .../internal/native/sse/skip_one_text_amd64.go | 6780 ++++---- .../bytedance/sonic/internal/native/sse/u64toa.go | 2 - .../sonic/internal/native/sse/u64toa_subr.go | 20 +- .../sonic/internal/native/sse/u64toa_text_amd64.go | 635 +- .../bytedance/sonic/internal/native/sse/unquote.go | 2 - .../sonic/internal/native/sse/unquote_subr.go | 36 +- .../internal/native/sse/unquote_text_amd64.go | 1133 +- .../sonic/internal/native/sse/validate_one.go | 2 - .../sonic/internal/native/sse/validate_one_subr.go | 38 +- .../internal/native/sse/validate_one_text_amd64.go | 6975 +++++---- .../sonic/internal/native/sse/validate_utf8.go | 2 - .../internal/native/sse/validate_utf8_fast.go | 2 - .../internal/native/sse/validate_utf8_fast_subr.go | 22 +- .../native/sse/validate_utf8_fast_text_amd64.go | 128 +- .../internal/native/sse/validate_utf8_subr.go | 30 +- .../native/sse/validate_utf8_text_amd64.go | 220 +- .../sonic/internal/native/sse/value_subr.go | 38 +- .../sonic/internal/native/sse/value_text_amd64.go | 11036 +++++++------ .../sonic/internal/native/sse/vnumber_subr.go | 36 +- .../internal/native/sse/vnumber_text_amd64.go | 8447 +++++----- .../sonic/internal/native/sse/vsigned_subr.go | 42 +- .../internal/native/sse/vsigned_text_amd64.go | 204 +- .../sonic/internal/native/sse/vstring_subr.go | 36 +- .../internal/native/sse/vstring_text_amd64.go | 1270 +- .../sonic/internal/native/sse/vunsigned_subr.go | 44 +- .../internal/native/sse/vunsigned_text_amd64.go | 201 +- .../sonic/internal/native/traceback_test.mock_tmpl | 379 + .../bytedance/sonic/internal/native/types/types.go | 5 +- .../bytedance/sonic/internal/native/u64toa.tmpl | 2 - .../bytedance/sonic/internal/native/unquote.tmpl | 2 - .../sonic/internal/native/validate_one.tmpl | 2 - .../sonic/internal/native/validate_utf8.tmpl | 2 - .../sonic/internal/native/validate_utf8_fast.tmpl | 2 - .../bytedance/sonic/internal/optcaching/asm.s | 0 .../bytedance/sonic/internal/optcaching/fcache.go | 362 + .../bytedance/sonic/internal/rt/asm_amd64.s | 41 +- .../bytedance/sonic/internal/rt/asm_compat.s | 1 + .../bytedance/sonic/internal/rt/assertI2I.go | 42 + .../bytedance/sonic/internal/rt/base64_amd64.go | 20 + .../bytedance/sonic/internal/rt/base64_compat.go | 20 + .../bytedance/sonic/internal/rt/fastconv.go | 175 + .../bytedance/sonic/internal/rt/fastmem.go | 36 +- .../bytedance/sonic/internal/rt/fastvalue.go | 236 +- .../github.com/bytedance/sonic/internal/rt/gcwb.go | 55 +- .../bytedance/sonic/internal/rt/gcwb_legacy.go | 29 + .../bytedance/sonic/internal/rt/growslice.go | 36 + .../sonic/internal/rt/growslice_legacy.go | 27 + .../github.com/bytedance/sonic/internal/rt/pool.go | 31 + .../bytedance/sonic/internal/rt/stackmap.go | 2 +- .../bytedance/sonic/internal/rt/stubs.go | 165 + .../bytedance/sonic/internal/rt/table.go | 118 + .../bytedance/sonic/internal/rt/types.go | 45 + .../bytedance/sonic/internal/utils/skip.go | 79 + .../bytedance/sonic/loader/funcdata_compat.go | 4 +- .../bytedance/sonic/loader/funcdata_go116.go | 461 - .../bytedance/sonic/loader/funcdata_go117.go | 461 + .../bytedance/sonic/loader/funcdata_go123.go | 118 + .../bytedance/sonic/loader/funcdata_latest.go | 4 +- .../bytedance/sonic/loader/loader_latest.go | 3 +- vendor/github.com/bytedance/sonic/option/option.go | 12 +- vendor/github.com/bytedance/sonic/rawmessage.go | 43 + vendor/github.com/bytedance/sonic/sonic.go | 11 +- vendor/github.com/bytedance/sonic/utf8/utf8.go | 12 +- vendor/github.com/gabriel-vasile/mimetype/LICENSE | 2 +- .../github.com/gabriel-vasile/mimetype/README.md | 5 +- .../gabriel-vasile/mimetype/internal/json/json.go | 27 +- .../mimetype/internal/magic/archive.go | 104 +- .../mimetype/internal/magic/binary.go | 35 +- .../gabriel-vasile/mimetype/internal/magic/ftyp.go | 43 +- .../mimetype/internal/magic/magic.go | 12 +- .../mimetype/internal/magic/ms_office.go | 45 +- .../gabriel-vasile/mimetype/internal/magic/text.go | 46 +- .../mimetype/internal/magic/text_csv.go | 42 +- .../gabriel-vasile/mimetype/internal/magic/zip.go | 90 +- .../gabriel-vasile/mimetype/mimetype.gif | Bin 1343793 -> 0 bytes .../github.com/gabriel-vasile/mimetype/mimetype.go | 8 +- .../gabriel-vasile/mimetype/supported_mimes.md | 32 +- vendor/github.com/gabriel-vasile/mimetype/tree.go | 49 +- vendor/github.com/gin-contrib/gzip/README.md | 1 - vendor/github.com/gin-contrib/gzip/handler.go | 10 +- vendor/github.com/gin-contrib/gzip/options.go | 4 +- .../go-playground/validator/v10/README.md | 3 +- .../go-playground/validator/v10/baked_in.go | 209 +- .../go-playground/validator/v10/cache.go | 2 +- .../go-playground/validator/v10/country_codes.go | 2320 +-- .../go-playground/validator/v10/currency_codes.go | 148 +- .../github.com/go-playground/validator/v10/doc.go | 29 +- .../validator/v10/postcode_regexes.go | 12 +- .../go-playground/validator/v10/regexes.go | 158 +- .../github.com/go-playground/validator/v10/util.go | 5 +- .../validator/v10/validator_instance.go | 8 +- .../goccy/go-json/internal/decoder/compile.go | 18 +- .../go-json/internal/decoder/compile_norace.go | 1 + .../goccy/go-json/internal/decoder/compile_race.go | 1 + .../goccy/go-json/internal/encoder/compiler.go | 16 +- .../go-json/internal/encoder/compiler_norace.go | 1 + .../go-json/internal/encoder/compiler_race.go | 1 + .../goccy/go-json/internal/encoder/encoder.go | 5 + vendor/github.com/klauspost/cpuid/v2/README.md | 1 + vendor/github.com/klauspost/cpuid/v2/cpuid.go | 84 +- vendor/github.com/klauspost/cpuid/v2/cpuid_arm64.s | 10 + .../github.com/klauspost/cpuid/v2/detect_arm64.go | 3 +- vendor/github.com/klauspost/cpuid/v2/detect_ref.go | 2 + vendor/github.com/klauspost/cpuid/v2/detect_x86.go | 3 + .../klauspost/cpuid/v2/featureid_string.go | 440 +- .../pelletier/go-toml/v2/.goreleaser.yaml | 1 + vendor/github.com/pelletier/go-toml/v2/README.md | 2 +- .../github.com/pelletier/go-toml/v2/marshaler.go | 24 +- .../github.com/pelletier/go-toml/v2/unmarshaler.go | 45 +- vendor/golang.org/x/arch/LICENSE | 4 +- vendor/golang.org/x/net/html/doctype.go | 2 +- vendor/golang.org/x/net/html/foreign.go | 3 +- vendor/golang.org/x/net/html/parse.go | 8 +- .../protobuf/encoding/protojson/decode.go | 2 +- .../protobuf/encoding/protojson/encode.go | 4 +- .../encoding/protojson/well_known_types.go | 6 +- .../protobuf/internal/descopts/options.go | 20 +- .../editiondefaults/editions_defaults.binpb | Bin 93 -> 138 bytes .../protobuf/internal/errors/is_go112.go | 40 - .../protobuf/internal/errors/is_go113.go | 13 - .../protobuf/internal/filedesc/desc.go | 22 + .../protobuf/internal/filedesc/desc_init.go | 2 + .../protobuf/internal/filedesc/desc_lazy.go | 2 + .../protobuf/internal/filedesc/editions.go | 10 +- .../protobuf/internal/genid/doc.go | 2 +- .../protobuf/internal/genid/go_features_gen.go | 49 +- .../protobuf/internal/genid/map_entry.go | 2 +- .../protobuf/internal/genid/name.go | 12 + .../protobuf/internal/genid/wrappers.go | 2 +- .../protobuf/internal/impl/api_export_opaque.go | 128 + .../protobuf/internal/impl/bitmap.go | 34 + .../protobuf/internal/impl/bitmap_race.go | 126 + .../protobuf/internal/impl/checkinit.go | 33 + .../protobuf/internal/impl/codec_extension.go | 11 +- .../protobuf/internal/impl/codec_field.go | 3 + .../protobuf/internal/impl/codec_field_opaque.go | 264 + .../protobuf/internal/impl/codec_message.go | 16 + .../protobuf/internal/impl/codec_message_opaque.go | 156 + .../protobuf/internal/impl/codec_reflect.go | 210 - .../protobuf/internal/impl/codec_unsafe.go | 3 - .../protobuf/internal/impl/convert.go | 2 +- .../protobuf/internal/impl/decode.go | 56 +- .../protobuf/internal/impl/encode.go | 80 +- .../protobuf/internal/impl/equal.go | 224 + .../protobuf/internal/impl/lazy.go | 433 + .../protobuf/internal/impl/legacy_extension.go | 1 + .../protobuf/internal/impl/merge.go | 27 + .../protobuf/internal/impl/message.go | 16 +- .../protobuf/internal/impl/message_opaque.go | 614 + .../protobuf/internal/impl/message_opaque_gen.go | 132 + .../protobuf/internal/impl/message_reflect.go | 5 + .../internal/impl/message_reflect_field.go | 32 +- .../internal/impl/message_reflect_field_gen.go | 273 + .../protobuf/internal/impl/pointer_reflect.go | 215 - .../protobuf/internal/impl/pointer_unsafe.go | 12 +- .../internal/impl/pointer_unsafe_opaque.go | 42 + .../protobuf/internal/impl/presence.go | 142 + .../protobuf/internal/impl/validate.go | 16 + .../protobuf/internal/protolazy/bufferreader.go | 364 + .../protobuf/internal/protolazy/lazy.go | 359 + .../protobuf/internal/protolazy/pointer_unsafe.go | 17 + .../protobuf/internal/strs/strings_pure.go | 28 - .../protobuf/internal/strs/strings_unsafe_go120.go | 3 +- .../protobuf/internal/strs/strings_unsafe_go121.go | 3 +- .../protobuf/internal/version/version.go | 4 +- vendor/google.golang.org/protobuf/proto/decode.go | 16 + vendor/google.golang.org/protobuf/proto/encode.go | 3 +- vendor/google.golang.org/protobuf/proto/equal.go | 9 + .../google.golang.org/protobuf/proto/extension.go | 71 + vendor/google.golang.org/protobuf/proto/size.go | 8 + .../protobuf/proto/wrapperopaque.go | 80 + .../protobuf/reflect/protoreflect/methods.go | 10 + .../protobuf/reflect/protoreflect/value.go | 2 +- .../protobuf/reflect/protoreflect/value_pure.go | 60 - .../reflect/protoreflect/value_unsafe_go120.go | 3 +- .../reflect/protoreflect/value_unsafe_go121.go | 3 +- .../protobuf/runtime/protoiface/methods.go | 34 + .../protobuf/runtime/protoimpl/impl.go | 4 + .../protobuf/types/known/anypb/any.pb.go | 33 +- .../protobuf/types/known/durationpb/duration.pb.go | 33 +- .../types/known/fieldmaskpb/field_mask.pb.go | 33 +- .../protobuf/types/known/structpb/struct.pb.go | 181 +- .../types/known/timestamppb/timestamp.pb.go | 33 +- .../protobuf/types/known/wrapperspb/wrappers.pb.go | 281 +- vendor/modules.txt | 49 +- 556 files changed, 163405 insertions(+), 138495 deletions(-) delete mode 100644 vendor/github.com/bytedance/sonic/ast/b64_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/ast/b64_compat.go create mode 100644 vendor/github.com/bytedance/sonic/ast/stubs.go delete mode 100644 vendor/github.com/bytedance/sonic/ast/stubs_go115.go delete mode 100644 vendor/github.com/bytedance/sonic/ast/stubs_go120.go delete mode 100644 vendor/github.com/bytedance/sonic/decoder/decoder_amd64.go create mode 100644 vendor/github.com/bytedance/sonic/decoder/decoder_native.go delete mode 100644 vendor/github.com/bytedance/sonic/encoder/encoder_amd64.go create mode 100644 vendor/github.com/bytedance/sonic/encoder/encoder_native.go create mode 100644 vendor/github.com/bytedance/sonic/go.work.sum create mode 100644 vendor/github.com/bytedance/sonic/internal/base64/b64_amd64.go create mode 100644 vendor/github.com/bytedance/sonic/internal/base64/b64_compat.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/api/decoder.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/api/decoder_amd64.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/api/decoder_arm64.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/api/stream.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/asm.s delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/asm_stubs_amd64_go116.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/asm_stubs_amd64_go117.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/asm_stubs_amd64_go121.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/assembler_regabi_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/assembler_stkabi_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/compiler.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/consts/option.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/debug.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/decoder.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/errors.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/errors/errors.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/generic_regabi_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/generic_regabi_amd64_test.s delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/generic_stkabi_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/generic_stkabi_amd64_test.s create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/jitdec/asm.s create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/jitdec/asm_stubs_amd64_go117.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/jitdec/asm_stubs_amd64_go121.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/jitdec/assembler_regabi_amd64.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/jitdec/compiler.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/jitdec/debug.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/jitdec/decoder.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/jitdec/generic_regabi_amd64.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/jitdec/generic_regabi_amd64_test.s create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/jitdec/pools.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/jitdec/primitives.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/jitdec/stubs_go116.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/jitdec/stubs_go120.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/jitdec/types.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/jitdec/utils.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/optdec/compile_struct.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/optdec/compiler.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/optdec/const.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/optdec/context.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/optdec/decoder.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/optdec/errors.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/optdec/functor.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/optdec/helper.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/optdec/interface.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/optdec/map.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/optdec/native.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/optdec/node.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/optdec/slice.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/optdec/stringopts.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/optdec/structs.go create mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/optdec/types.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/pools.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/primitives.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/stream.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/stubs_go116.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/stubs_go120.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/types.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/decoder/utils.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/alg/mapiter.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/alg/opts.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/alg/primitives.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/alg/sort.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/alg/spec.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/alg/spec_compat.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/asm.s delete mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/asm_stubs_amd64_go116.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/asm_stubs_amd64_go117.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/asm_stubs_amd64_go121.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/assembler_regabi_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/assembler_stkabi_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/debug_go116.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/debug_go117.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/encode_norace.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/encode_race.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/errors.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/ir/op.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/mapiter.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/pools.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/pools_amd64.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/pools_compt.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/primitives.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/sort.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/stubs_go116.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/stubs_go117.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/stubs_go120.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/stubs_go121.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/types.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/utils.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/vars/cache.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/vars/const.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/vars/errors.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/vars/stack.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/vars/types.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/vm/stbus.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/vm/vm.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/x86/asm_stubs_amd64_go117.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/x86/asm_stubs_amd64_go121.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/x86/assembler_regabi_amd64.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/x86/debug_go116.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/x86/debug_go117.go create mode 100644 vendor/github.com/bytedance/sonic/internal/encoder/x86/stbus.go create mode 100644 vendor/github.com/bytedance/sonic/internal/envs/decode.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/f32toa.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/f32toa_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/f32toa_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/f64toa.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/f64toa_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/f64toa_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/get_by_path.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/get_by_path_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/get_by_path_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/html_escape.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/html_escape_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/html_escape_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/i64toa.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/i64toa_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/i64toa_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/lspace.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/lspace_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/lspace_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/native_export.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/quote.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/quote_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/quote_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/skip_array.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/skip_array_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/skip_array_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/skip_number.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/skip_number_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/skip_number_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/skip_object.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/skip_object_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/skip_object_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/skip_one.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/skip_one_fast.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/skip_one_fast_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/skip_one_fast_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/skip_one_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/skip_one_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/u64toa.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/u64toa_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/u64toa_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/unquote.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/unquote_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/unquote_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/validate_one.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/validate_one_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/validate_one_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/validate_utf8.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/validate_utf8_fast.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/validate_utf8_fast_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/validate_utf8_fast_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/validate_utf8_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/validate_utf8_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/value.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/value_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/value_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/vnumber.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/vnumber_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/vnumber_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/vsigned.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/vsigned_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/vsigned_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/vstring.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/vstring_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/vstring_text_amd64.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/vunsigned.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/vunsigned_subr.go delete mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx/vunsigned_text_amd64.go create mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx2/lookup_small_key.go create mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx2/lookup_small_key_subr.go create mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx2/lookup_small_key_text_amd64.go create mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx2/parse_with_padding.go create mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx2/parse_with_padding_subr.go create mode 100644 vendor/github.com/bytedance/sonic/internal/native/avx2/parse_with_padding_text_amd64.go create mode 100644 vendor/github.com/bytedance/sonic/internal/native/lookup_small_key.tmpl create mode 100644 vendor/github.com/bytedance/sonic/internal/native/neon/lookup_small_key_arm64.go create mode 100644 vendor/github.com/bytedance/sonic/internal/native/neon/lookup_small_key_arm64.s create mode 100644 vendor/github.com/bytedance/sonic/internal/native/neon/lookup_small_key_subr_arm64.go create mode 100644 vendor/github.com/bytedance/sonic/internal/native/neon/parse_with_padding_arm64.go create mode 100644 vendor/github.com/bytedance/sonic/internal/native/neon/parse_with_padding_arm64.s create mode 100644 vendor/github.com/bytedance/sonic/internal/native/neon/parse_with_padding_subr_arm64.go create mode 100644 vendor/github.com/bytedance/sonic/internal/native/parse_with_padding.tmpl create mode 100644 vendor/github.com/bytedance/sonic/internal/native/sse/lookup_small_key.go create mode 100644 vendor/github.com/bytedance/sonic/internal/native/sse/lookup_small_key_subr.go create mode 100644 vendor/github.com/bytedance/sonic/internal/native/sse/lookup_small_key_text_amd64.go create mode 100644 vendor/github.com/bytedance/sonic/internal/native/sse/parse_with_padding.go create mode 100644 vendor/github.com/bytedance/sonic/internal/native/sse/parse_with_padding_subr.go create mode 100644 vendor/github.com/bytedance/sonic/internal/native/sse/parse_with_padding_text_amd64.go create mode 100644 vendor/github.com/bytedance/sonic/internal/native/traceback_test.mock_tmpl create mode 100644 vendor/github.com/bytedance/sonic/internal/optcaching/asm.s create mode 100644 vendor/github.com/bytedance/sonic/internal/optcaching/fcache.go create mode 100644 vendor/github.com/bytedance/sonic/internal/rt/assertI2I.go create mode 100644 vendor/github.com/bytedance/sonic/internal/rt/base64_amd64.go create mode 100644 vendor/github.com/bytedance/sonic/internal/rt/base64_compat.go create mode 100644 vendor/github.com/bytedance/sonic/internal/rt/fastconv.go create mode 100644 vendor/github.com/bytedance/sonic/internal/rt/gcwb_legacy.go create mode 100644 vendor/github.com/bytedance/sonic/internal/rt/growslice.go create mode 100644 vendor/github.com/bytedance/sonic/internal/rt/growslice_legacy.go create mode 100644 vendor/github.com/bytedance/sonic/internal/rt/pool.go create mode 100644 vendor/github.com/bytedance/sonic/internal/rt/stubs.go create mode 100644 vendor/github.com/bytedance/sonic/internal/rt/table.go create mode 100644 vendor/github.com/bytedance/sonic/internal/rt/types.go create mode 100644 vendor/github.com/bytedance/sonic/internal/utils/skip.go delete mode 100644 vendor/github.com/bytedance/sonic/loader/funcdata_go116.go create mode 100644 vendor/github.com/bytedance/sonic/loader/funcdata_go117.go create mode 100644 vendor/github.com/bytedance/sonic/loader/funcdata_go123.go create mode 100644 vendor/github.com/bytedance/sonic/rawmessage.go delete mode 100644 vendor/github.com/gabriel-vasile/mimetype/mimetype.gif delete mode 100644 vendor/google.golang.org/protobuf/internal/errors/is_go112.go delete mode 100644 vendor/google.golang.org/protobuf/internal/errors/is_go113.go create mode 100644 vendor/google.golang.org/protobuf/internal/genid/name.go create mode 100644 vendor/google.golang.org/protobuf/internal/impl/api_export_opaque.go create mode 100644 vendor/google.golang.org/protobuf/internal/impl/bitmap.go create mode 100644 vendor/google.golang.org/protobuf/internal/impl/bitmap_race.go create mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_field_opaque.go create mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_message_opaque.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go create mode 100644 vendor/google.golang.org/protobuf/internal/impl/equal.go create mode 100644 vendor/google.golang.org/protobuf/internal/impl/lazy.go create mode 100644 vendor/google.golang.org/protobuf/internal/impl/message_opaque.go create mode 100644 vendor/google.golang.org/protobuf/internal/impl/message_opaque_gen.go create mode 100644 vendor/google.golang.org/protobuf/internal/impl/message_reflect_field_gen.go delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go create mode 100644 vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe_opaque.go create mode 100644 vendor/google.golang.org/protobuf/internal/impl/presence.go create mode 100644 vendor/google.golang.org/protobuf/internal/protolazy/bufferreader.go create mode 100644 vendor/google.golang.org/protobuf/internal/protolazy/lazy.go create mode 100644 vendor/google.golang.org/protobuf/internal/protolazy/pointer_unsafe.go delete mode 100644 vendor/google.golang.org/protobuf/internal/strs/strings_pure.go create mode 100644 vendor/google.golang.org/protobuf/proto/wrapperopaque.go delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go diff --git a/go.mod b/go.mod index c8537f915..5b75f23a2 100644 --- a/go.mod +++ b/go.mod @@ -47,7 +47,7 @@ require ( github.com/buckket/go-blurhash v1.1.0 github.com/coreos/go-oidc/v3 v3.11.0 github.com/gin-contrib/cors v1.7.2 - github.com/gin-contrib/gzip v1.0.1 + github.com/gin-contrib/gzip v1.1.0 github.com/gin-contrib/sessions v1.0.1 github.com/gin-gonic/gin v1.10.0 github.com/go-playground/form/v4 v4.2.1 @@ -93,7 +93,7 @@ require ( go.uber.org/automaxprocs v1.6.0 golang.org/x/crypto v0.31.0 golang.org/x/image v0.23.0 - golang.org/x/net v0.32.0 + golang.org/x/net v0.33.0 golang.org/x/oauth2 v0.24.0 golang.org/x/text v0.21.0 gopkg.in/mcuadros/go-syslog.v2 v2.3.0 @@ -114,8 +114,8 @@ require ( github.com/bahlo/generic-list-go v0.2.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/buger/jsonparser v1.1.1 // indirect - github.com/bytedance/sonic v1.11.6 // indirect - github.com/bytedance/sonic/loader v0.1.1 // indirect + github.com/bytedance/sonic v1.12.6 // indirect + github.com/bytedance/sonic/loader v0.2.1 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cilium/ebpf v0.9.1 // indirect @@ -133,7 +133,7 @@ require ( github.com/dustin/go-humanize v1.0.1 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/gabriel-vasile/mimetype v1.4.3 // indirect + github.com/gabriel-vasile/mimetype v1.4.7 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-errors/errors v1.1.1 // indirect github.com/go-fed/httpsig v1.1.0 // indirect @@ -154,9 +154,9 @@ require ( github.com/go-openapi/validate v0.24.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.20.0 // indirect + github.com/go-playground/validator/v10 v10.23.0 // indirect github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b // indirect - github.com/goccy/go-json v0.10.3 // indirect + github.com/goccy/go-json v0.10.4 // indirect github.com/godbus/dbus/v5 v5.0.4 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/golang/geo v0.0.0-20200319012246-673a6f80352d // indirect @@ -179,7 +179,7 @@ require ( github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.17.11 // indirect - github.com/klauspost/cpuid/v2 v2.2.8 // indirect + github.com/klauspost/cpuid/v2 v2.2.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect @@ -196,7 +196,7 @@ require ( github.com/ncruces/julianday v1.0.0 // indirect github.com/opencontainers/runtime-spec v1.0.2 // indirect github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect - github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.1 // indirect @@ -231,7 +231,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.29.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/arch v0.8.0 // indirect + golang.org/x/arch v0.12.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect golang.org/x/mod v0.18.0 // indirect golang.org/x/sync v0.10.0 // indirect @@ -240,7 +240,7 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect google.golang.org/grpc v1.66.1 // indirect - google.golang.org/protobuf v1.34.2 // indirect + google.golang.org/protobuf v1.36.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect diff --git a/go.sum b/go.sum index 3dca6a3ae..30cc57e1f 100644 --- a/go.sum +++ b/go.sum @@ -105,10 +105,11 @@ github.com/buckket/go-blurhash v1.1.0 h1:X5M6r0LIvwdvKiUtiNcRL2YlmOfMzYobI3VCKCZ github.com/buckket/go-blurhash v1.1.0/go.mod h1:aT2iqo5W9vu9GpyoLErKfTHwgODsZp3bQfXjXJUxNb8= github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= -github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0= -github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= -github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= +github.com/bytedance/sonic v1.12.6 h1:/isNmCUF2x3Sh8RAp/4mh4ZGkcFAX/hLrzrK3AvpRzk= +github.com/bytedance/sonic v1.12.6/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKzMzT9r/rk= github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= +github.com/bytedance/sonic/loader v0.2.1 h1:1GgorWTqf12TA8mma4DDSbaQigE2wOgQo7iCjjJv3+E= +github.com/bytedance/sonic/loader v0.2.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -176,14 +177,14 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fxamacker/cbor v1.5.1 h1:XjQWBgdmQyqimslUh5r4tUGmoqzHmBFQOImkWGi2awg= github.com/fxamacker/cbor v1.5.1/go.mod h1:3aPGItF174ni7dDzd6JZ206H8cmr4GDNBGpPa971zsU= -github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= -github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= +github.com/gabriel-vasile/mimetype v1.4.7 h1:SKFKl7kD0RiPdbht0s7hFtjl489WcQ1VyPW8ZzUMYCA= +github.com/gabriel-vasile/mimetype v1.4.7/go.mod h1:GDlAgAyIRT27BhFl53XNAFtfjzOkLaF35JdEG0P7LtU= github.com/gavv/httpexpect v2.0.0+incompatible h1:1X9kcRshkSKEjNJJxX9Y9mQ5BRfbxU5kORdjhlA1yX8= github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= github.com/gin-contrib/cors v1.7.2 h1:oLDHxdg8W/XDoN/8zamqk/Drgt4oVZDvaV0YmvVICQw= github.com/gin-contrib/cors v1.7.2/go.mod h1:SUJVARKgQ40dmrzgXEVxj2m7Ig1v1qIboQkPDTQ9t2E= -github.com/gin-contrib/gzip v1.0.1 h1:HQ8ENHODeLY7a4g1Au/46Z92bdGFl74OhxcZble9WJE= -github.com/gin-contrib/gzip v1.0.1/go.mod h1:njt428fdUNRvjuJf16tZMYZ2Yl+WQB53X5wmhDwXvC4= +github.com/gin-contrib/gzip v1.1.0 h1:kVw7Nr9M+Z6Ch4qo7aGMbiqxDeyQFru+07MgAcUF62M= +github.com/gin-contrib/gzip v1.1.0/go.mod h1:iHJXCup4CWiKyPUEl+GwkHjchl+YyYuMKbOCiXujPIA= github.com/gin-contrib/sessions v1.0.1 h1:3hsJyNs7v7N8OtelFmYXFrulAf6zSR7nW/putcPEHxI= github.com/gin-contrib/sessions v1.0.1/go.mod h1:ouxSFM24/OgIud5MJYQJLpy6AwxQ5EYO9yLhbtObGkM= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= @@ -239,15 +240,15 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= -github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/go-playground/validator/v10 v10.23.0 h1:/PwmTwZhS0dPkav3cdK9kV1FsAmrL8sThn8IHr/sO+o= +github.com/go-playground/validator/v10 v10.23.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/go-session/session v3.1.2+incompatible/go.mod h1:8B3iivBQjrz/JtC68Np2T1yBBLxTan3mn/3OM0CyRt0= github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b h1:khEcpUM4yFcxg4/FHQWkvVRmgijNXRfzkIDHh23ggEo= github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= -github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= -github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= +github.com/goccy/go-json v0.10.4 h1:JSwxQzIqKfmFX1swYPpUThQZp/Ka4wzJdK0LWVytLPM= +github.com/goccy/go-json v0.10.4/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/godbus/dbus/v5 v5.0.4 h1:9349emZab16e7zQvpmsbtjc18ykshndd8y2PG3sgJbA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= @@ -385,8 +386,8 @@ github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IX github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.8 h1:+StwCXwm9PdpiEkPyzBXIy+M9KUb4ODm0Zarf1kS5BM= -github.com/klauspost/cpuid/v2 v2.2.8/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/cpuid/v2 v2.2.9 h1:66ze0taIn2H33fBvCkXuv9BmCwDfafmiIVpKV9kKGuY= +github.com/klauspost/cpuid/v2 v2.2.9/go.mod h1:rqkxqrZ1EhYM9G+hXH7YdowN5R5RGN6NK4QwQ3WMXF8= github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -452,8 +453,8 @@ github.com/opencontainers/runtime-spec v1.0.2 h1:UfAcuLBJB9Coz72x1hgl8O5RVzTdNia github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= -github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= -github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -516,7 +517,6 @@ github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -526,8 +526,6 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -665,9 +663,8 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= -golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc= -golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= +golang.org/x/arch v0.12.0 h1:UsYJhbzPYGsT0HbEdmYcqtCv8UNGvnaL561NnIUvaKg= +golang.org/x/arch v0.12.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -746,8 +743,8 @@ golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= -golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= +golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -805,7 +802,6 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= @@ -953,8 +949,8 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk= +google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1012,6 +1008,5 @@ mvdan.cc/xurls/v2 v2.5.0 h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8= mvdan.cc/xurls/v2 v2.5.0/go.mod h1:yQgaGQ1rFtJUzkmKiHYSSfuQxqfYmd//X6PxvholpeE= nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/vendor/github.com/bytedance/sonic/.gitignore b/vendor/github.com/bytedance/sonic/.gitignore index 0d8844705..fa60f43a2 100644 --- a/vendor/github.com/bytedance/sonic/.gitignore +++ b/vendor/github.com/bytedance/sonic/.gitignore @@ -49,4 +49,7 @@ ast/bench.sh !testdata/*.json.gz fuzz/testdata -*__debug_bin \ No newline at end of file +*__debug_bin* +*pprof +*coverage.txt +tools/venv/* \ No newline at end of file diff --git a/vendor/github.com/bytedance/sonic/README.md b/vendor/github.com/bytedance/sonic/README.md index f3c736352..5f609b1c3 100644 --- a/vendor/github.com/bytedance/sonic/README.md +++ b/vendor/github.com/bytedance/sonic/README.md @@ -6,9 +6,9 @@ A blazingly fast JSON serializing & deserializing library, accelerated by JI ## Requirement -- Go 1.16~1.22 -- Linux / MacOS / Windows(need go1.17 above) -- Amd64 ARCH +- Go: 1.17~1.23 +- OS: Linux / MacOS / Windows +- CPU: AMD64 / ARM64(need go1.20 above) ## Features @@ -282,6 +282,22 @@ sub := root.Get("key3").Index(2).Int64() // == 3 **Tip**: since `Index()` uses offset to locate data, which is much faster than scanning like `Get()`, we suggest you use it as much as possible. And sonic also provides another API `IndexOrGet()` to underlying use offset as well as ensure the key is matched. +#### SearchOption + +`Searcher` provides some options for user to meet different needs: + +```go +opts := ast.SearchOption{ CopyReturn: true ... } +val, err := sonic.GetWithOptions(JSON, opts, "key") +``` + +- CopyReturn +Indicate the searcher to copy the result JSON string instead of refer from the input. This can help to reduce memory usage if you cache the results +- ConcurentRead +Since `ast.Node` use `Lazy-Load` design, it doesn't support Concurrently-Read by default. If you want to read it concurrently, please specify it. +- ValidateJSON +Indicate the searcher to validate the entire JSON. This option is enabled by default, which slow down the search speed a little. + #### Set/Unset Modify the json content by Set()/Unset() @@ -368,16 +384,12 @@ See [ast/visitor.go](https://github.com/bytedance/sonic/blob/main/ast/visitor.go ## Compatibility -Sonic **DOES NOT** ensure to support all environments, due to the difficulty of developing high-performance codes. For developers who use sonic to build their applications in different environments, we have the following suggestions: - -- Developing on **Mac M1**: Make sure you have Rosetta 2 installed on your machine, and set `GOARCH=amd64` when building your application. Rosetta 2 can automatically translate x86 binaries to arm64 binaries and run x86 applications on Mac M1. -- Developing on **Linux arm64**: You can install qemu and use the `qemu-x86_64 -cpu max` command to convert x86 binaries to amr64 binaries for applications built with sonic. The qemu can achieve a similar transfer effect to Rosetta 2 on Mac M1. +For developers who want to use sonic to meet diffirent scenarios, we provide some integrated configs as `sonic.API` -For developers who want to use sonic on Linux arm64 without qemu, or those who want to handle JSON strictly consistent with `encoding/json`, we provide some compatible APIs as `sonic.API` - -- `ConfigDefault`: the sonic's default config (`EscapeHTML=false`,`SortKeys=false`...) to run on sonic-supporting environment. It will fall back to `encoding/json` with the corresponding config, and some options like `SortKeys=false` will be invalid. -- `ConfigStd`: the std-compatible config (`EscapeHTML=true`,`SortKeys=true`...) to run on sonic-supporting environment. It will fall back to `encoding/json`. -- `ConfigFastest`: the fastest config (`NoQuoteTextMarshaler=true`) to run on sonic-supporting environment. It will fall back to `encoding/json` with the corresponding config, and some options will be invalid. +- `ConfigDefault`: the sonic's default config (`EscapeHTML=false`,`SortKeys=false`...) to run sonic fast meanwhile ensure security. +- `ConfigStd`: the std-compatible config (`EscapeHTML=true`,`SortKeys=true`...) +- `ConfigFastest`: the fastest config (`NoQuoteTextMarshaler=true`) to run on sonic as fast as possible. +Sonic **DOES NOT** ensure to support all environments, due to the difficulty of developing high-performance codes. On non-sonic-supporting environment, the implementation will fall back to `encoding/json`. Thus beflow configs will all equal to `ConfigStd`. ## Tips @@ -466,6 +478,18 @@ For better performance, in previous case the `ast.Visitor` will be the better ch But `ast.Visitor` is not a very handy API. You might need to write a lot of code to implement your visitor and carefully maintain the tree hierarchy during decoding. Please read the comments in [ast/visitor.go](https://github.com/bytedance/sonic/blob/main/ast/visitor.go) carefully if you decide to use this API. +### Buffer Size + +Sonic use memory pool in many places like `encoder.Encode`, `ast.Node.MarshalJSON` to improve performace, which may produce more memory usage (in-use) when server's load is high. See [issue 614](https://github.com/bytedance/sonic/issues/614). Therefore, we introduce some options to let user control the behavior of memory pool. See [option](https://pkg.go.dev/github.com/bytedance/sonic@v1.11.9/option#pkg-variables) package. + +### Faster JSON skip + +For security, sonic use [FSM](native/skip_one.c) algorithm to validate JSON when decoding raw JSON or encoding `json.Marshaler`, which is much slower (1~10x) than [SIMD-searching-pair](native/skip_one_fast.c) algorithm. If user has many redundant JSON value and DO NOT NEED to strictly validate JSON correctness, you can enable below options: + +- `Config.NoValidateSkipJSON`: for faster skipping JSON when decoding, such as unknown fields, json.Unmarshaler(json.RawMessage), mismatched values, and redundant array elements +- `Config.NoValidateJSONMarshaler`: avoid validating JSON when encoding `json.Marshaler` +- `SearchOption.ValidateJSON`: indicates if validate located JSON value when `Get` + ## Community Sonic is a subproject of [CloudWeGo](https://www.cloudwego.io/). We are committed to building a cloud native ecosystem. diff --git a/vendor/github.com/bytedance/sonic/README_ZH_CN.md b/vendor/github.com/bytedance/sonic/README_ZH_CN.md index d0341ab72..cf6e80764 100644 --- a/vendor/github.com/bytedance/sonic/README_ZH_CN.md +++ b/vendor/github.com/bytedance/sonic/README_ZH_CN.md @@ -6,9 +6,9 @@ ## 依赖 -- Go 1.16~1.22 -- Linux / MacOS / Windows(需要 Go1.17 以上) -- Amd64 架构 +- Go: 1.17~1.23 +- OS: Linux / MacOS / Windows +- CPU: AMD64 / ARM64(需要 Go1.20 以上) ## 接口 @@ -260,7 +260,7 @@ fmt.Printf("%+v", data) // {A:0 B:1} ### `Ast.Node` -Sonic/ast.Node 是完全独立的 JSON 抽象语法树库。它实现了序列化和反序列化,并提供了获取和修改通用数据的鲁棒的 API。 +Sonic/ast.Node 是完全独立的 JSON 抽象语法树库。它实现了序列化和反序列化,并提供了获取和修改JSON数据的鲁棒的 API。 #### 查找/索引 @@ -282,6 +282,22 @@ sub := root.Get("key3").Index(2).Int64() // == 3 **注意**:由于 `Index()` 使用偏移量来定位数据,比使用扫描的 `Get()` 要快的多,建议尽可能的使用 `Index` 。 Sonic 也提供了另一个 API, `IndexOrGet()` ,以偏移量为基础并且也确保键的匹配。 +#### 查找选项 + +`ast.Searcher`提供了一些选项,以满足用户的不同需求: + +```go +opts := ast.SearchOption{CopyReturn: true…} +val, err := sonic.GetWithOptions(JSON, opts, "key") +``` + +- CopyReturn +指示搜索器复制结果JSON字符串,而不是从输入引用。如果用户缓存结果,这有助于减少内存使用 +- ConcurentRead +因为`ast.Node`使用`Lazy-Load`设计,默认不支持并发读取。如果您想同时读取,请指定它。 +- ValidateJSON +指示搜索器来验证整个JSON。默认情况下启用该选项, 但是对于查找速度有一定影响。 + #### 修改 使用 `Set()` / `Unset()` 修改 json 的内容 @@ -368,16 +384,12 @@ type Visitor interface { ## 兼容性 -由于开发高性能代码的困难性, Sonic **不**保证对所有环境的支持。对于在不同环境中使用 Sonic 构建应用程序的开发者,我们有以下建议: - -- 在 **Mac M1** 上开发:确保在您的计算机上安装了 Rosetta 2,并在构建时设置 `GOARCH=amd64` 。 Rosetta 2 可以自动将 x86 二进制文件转换为 arm64 二进制文件,并在 Mac M1 上运行 x86 应用程序。 -- 在 **Linux arm64** 上开发:您可以安装 qemu 并使用 `qemu-x86_64 -cpu max` 命令来将 x86 二进制文件转换为 arm64 二进制文件。qemu可以实现与Mac M1上的Rosetta 2类似的转换效果。 +对于想要使用sonic来满足不同场景的开发人员,我们提供了一些集成配置: -对于希望在不使用 qemu 下使用 sonic 的开发者,或者希望处理 JSON 时与 `encoding/JSON` 严格保持一致的开发者,我们在 `sonic.API` 中提供了一些兼容性 API - -- `ConfigDefault`: 在支持 sonic 的环境下 sonic 的默认配置(`EscapeHTML=false`,`SortKeys=false`等)。行为与具有相应配置的 `encoding/json` 一致,一些选项,如 `SortKeys=false` 将无效。 -- `ConfigStd`: 在支持 sonic 的环境下与标准库兼容的配置(`EscapeHTML=true`,`SortKeys=true`等)。行为与 `encoding/json` 一致。 -- `ConfigFastest`: 在支持 sonic 的环境下运行最快的配置(`NoQuoteTextMarshaler=true`)。行为与具有相应配置的 `encoding/json` 一致,某些选项将无效。 +- `ConfigDefault`: sonic的默认配置 (`EscapeHTML=false`, `SortKeys=false`…) 保证性能同时兼顾安全性。 +- `ConfigStd`: 与 `encoding/json` 保证完全兼容的配置 +- `ConfigFastest`: 最快的配置(`NoQuoteTextMarshaler=true...`) 保证性能最优但是会缺少一些安全性检查(validate UTF8 等) +Sonic **不**确保支持所有环境,由于开发高性能代码的困难。在不支持sonic的环境中,实现将回落到 `encoding/json`。因此上述配置将全部等于`ConfigStd`。 ## 注意事项 @@ -464,6 +476,18 @@ go someFunc(user) 但是,`ast.Visitor` 并不是一个很易用的 API。你可能需要写大量的代码去实现自己的 `ast.Visitor`,并且需要在解析过程中仔细维护树的层级。如果你决定要使用这个 API,请先仔细阅读 [ast/visitor.go](https://github.com/bytedance/sonic/blob/main/ast/visitor.go) 中的注释。 +### 缓冲区大小 + +Sonic在许多地方使用内存池,如`encoder.Encode`, `ast.Node.MarshalJSON`等来提高性能,这可能会在服务器负载高时产生更多的内存使用(in-use)。参见[issue 614](https://github.com/bytedance/sonic/issues/614)。因此,我们引入了一些选项来让用户配置内存池的行为。参见[option](https://pkg.go.dev/github.com/bytedance/sonic@v1.11.9/option#pkg-variables)包。 + +### 更快的 JSON Skip + +为了安全起见,在跳过原始JSON 时,sonic decoder 默认使用[FSM](native/skip_one.c)算法扫描来跳过同时校验 JSON。它相比[SIMD-searching-pair](native/skip_one_fast.c)算法跳过要慢得多(1~10倍)。如果用户有很多冗余的JSON值,并且不需要严格验证JSON的正确性,你可以启用以下选项: + +- `Config.NoValidateSkipJSON`: 用于在解码时更快地跳过JSON,例如未知字段,`json.RawMessage`,不匹配的值和冗余的数组元素等 +- `Config.NoValidateJSONMarshaler`: 编码JSON时避免验证JSON。封送拆收器 +- `SearchOption.ValidateJSON`: 指示当`Get`时是否验证定位的JSON值 + ## 社区 Sonic 是 [CloudWeGo](https://www.cloudwego.io/) 下的一个子项目。我们致力于构建云原生生态系统。 diff --git a/vendor/github.com/bytedance/sonic/api.go b/vendor/github.com/bytedance/sonic/api.go index 093329127..af6be70a4 100644 --- a/vendor/github.com/bytedance/sonic/api.go +++ b/vendor/github.com/bytedance/sonic/api.go @@ -23,6 +23,16 @@ import ( `github.com/bytedance/sonic/internal/rt` ) +const ( + // UseStdJSON indicates you are using fallback implementation (encoding/json) + UseStdJSON = iota + // UseSonicJSON indicates you are using real sonic implementation + UseSonicJSON +) + +// APIKind is the kind of API, 0 is std json, 1 is sonic. +const APIKind = apiKind + // Config is a combination of sonic/encoder.Options and sonic/decoder.Options type Config struct { // EscapeHTML indicates encoder to escape all HTML characters @@ -74,9 +84,16 @@ type Config struct { // NoValidateJSONMarshaler indicates that the encoder should not validate the output string // after encoding the JSONMarshaler to JSON. NoValidateJSONMarshaler bool + + // NoValidateJSONSkip indicates the decoder should not validate the JSON value when skipping it, + // such as unknown-fields, mismatched-type, redundant elements.. + NoValidateJSONSkip bool // NoEncoderNewline indicates that the encoder should not add a newline after every message NoEncoderNewline bool + + // Encode Infinity or Nan float into `null`, instead of returning an error. + EncodeNullForInfOrNan bool } var ( @@ -96,6 +113,7 @@ var ( ConfigFastest = Config{ NoQuoteTextMarshaler: true, NoValidateJSONMarshaler: true, + NoValidateJSONSkip: true, }.Froze() ) @@ -157,6 +175,13 @@ func Marshal(val interface{}) ([]byte, error) { return ConfigDefault.Marshal(val) } +// MarshalIndent is like Marshal but applies Indent to format the output. +// Each JSON element in the output will begin on a new line beginning with prefix +// followed by one or more copies of indent according to the indentation nesting. +func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) { + return ConfigDefault.MarshalIndent(v, prefix, indent) +} + // MarshalString returns the JSON encoding string of v. func MarshalString(val interface{}) (string, error) { return ConfigDefault.MarshalToString(val) @@ -189,6 +214,14 @@ func Get(src []byte, path ...interface{}) (ast.Node, error) { return GetCopyFromString(rt.Mem2Str(src), path...) } +//GetWithOptions searches and locates the given path from src json, +// with specific options of ast.Searcher +func GetWithOptions(src []byte, opts ast.SearchOptions, path ...interface{}) (ast.Node, error) { + s := ast.NewSearcher(rt.Mem2Str(src)) + s.SearchOptions = opts + return s.GetByPath(path...) +} + // GetFromString is same with Get except src is string. // // WARNING: The returned JSON is **Referenced** from the input. diff --git a/vendor/github.com/bytedance/sonic/ast/api.go b/vendor/github.com/bytedance/sonic/ast/api.go index 316a62a9d..7c8253aa1 100644 --- a/vendor/github.com/bytedance/sonic/ast/api.go +++ b/vendor/github.com/bytedance/sonic/ast/api.go @@ -1,5 +1,5 @@ -//go:build (amd64 && go1.16 && !go1.23) || (arm64 && go1.20 && !go1.23) -// +build amd64,go1.16,!go1.23 arm64,go1.20,!go1.23 +//go:build (amd64 && go1.17 && !go1.24) || (arm64 && go1.20 && !go1.24) +// +build amd64,go1.17,!go1.24 arm64,go1.20,!go1.24 /* * Copyright 2022 ByteDance Inc. @@ -61,7 +61,7 @@ func quote(buf *[]byte, val string) { } // double buf size - *b = growslice(typeByte, *b, b.Cap*2) + *b = rt.GrowSlice(typeByte, *b, b.Cap*2) // ret is the complement of consumed input ret = ^ret // update input buffer diff --git a/vendor/github.com/bytedance/sonic/ast/api_compat.go b/vendor/github.com/bytedance/sonic/ast/api_compat.go index 82d1eacd3..a349afc0b 100644 --- a/vendor/github.com/bytedance/sonic/ast/api_compat.go +++ b/vendor/github.com/bytedance/sonic/ast/api_compat.go @@ -1,4 +1,4 @@ -// +build !amd64,!arm64 go1.23 !go1.16 arm64,!go1.20 +// +build !amd64,!arm64 go1.24 !go1.17 arm64,!go1.20 /* * Copyright 2022 ByteDance Inc. @@ -27,7 +27,7 @@ import ( ) func init() { - println("WARNING:(ast) sonic only supports Go1.16~1.22, but your environment is not suitable") + println("WARNING:(ast) sonic only supports go1.17~1.23, but your environment is not suitable") } func quote(buf *[]byte, val string) { diff --git a/vendor/github.com/bytedance/sonic/ast/b64_amd64.go b/vendor/github.com/bytedance/sonic/ast/b64_amd64.go deleted file mode 100644 index 3e32b600b..000000000 --- a/vendor/github.com/bytedance/sonic/ast/b64_amd64.go +++ /dev/null @@ -1,31 +0,0 @@ -// +build amd64,go1.16 - -/** - * Copyright 2023 ByteDance Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ast - -import ( - `github.com/cloudwego/base64x` -) - -func decodeBase64(src string) ([]byte, error) { - return base64x.StdEncoding.DecodeString(src) -} - -func encodeBase64(src []byte) string { - return base64x.StdEncoding.EncodeToString(src) -} diff --git a/vendor/github.com/bytedance/sonic/ast/b64_compat.go b/vendor/github.com/bytedance/sonic/ast/b64_compat.go deleted file mode 100644 index e8f9a72fd..000000000 --- a/vendor/github.com/bytedance/sonic/ast/b64_compat.go +++ /dev/null @@ -1,31 +0,0 @@ -// +build !amd64 !go1.16 - -/* - * Copyright 2022 ByteDance Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ast - -import ( - `encoding/base64` -) - -func decodeBase64(src string) ([]byte, error) { - return base64.StdEncoding.DecodeString(src) -} - -func encodeBase64(src []byte) string { - return base64.StdEncoding.EncodeToString(src) -} diff --git a/vendor/github.com/bytedance/sonic/ast/buffer.go b/vendor/github.com/bytedance/sonic/ast/buffer.go index bccbf4814..04701ef5b 100644 --- a/vendor/github.com/bytedance/sonic/ast/buffer.go +++ b/vendor/github.com/bytedance/sonic/ast/buffer.go @@ -17,8 +17,10 @@ package ast import ( - `sort` - `unsafe` + "sort" + "unsafe" + + "github.com/bytedance/sonic/internal/caching" ) type nodeChunk [_DEFAULT_NODE_CAP]Node @@ -90,18 +92,11 @@ func (self *linkedNodes) Pop() { self.size-- } -func (self *linkedPairs) Pop() { - if self == nil || self.size == 0 { - return - } - self.Set(self.size-1, Pair{}) - self.size-- -} - func (self *linkedNodes) Push(v Node) { self.Set(self.size, v) } + func (self *linkedNodes) Set(i int, v Node) { if i < _DEFAULT_NODE_CAP { self.head[i] = v @@ -195,11 +190,22 @@ func (self *linkedNodes) FromSlice(con []Node) { type pairChunk [_DEFAULT_NODE_CAP]Pair type linkedPairs struct { + index map[uint64]int head pairChunk tail []*pairChunk size int } +func (self *linkedPairs) BuildIndex() { + if self.index == nil { + self.index = make(map[uint64]int, self.size) + } + for i:=0; i len(src) { return -int(types.ERR_EOF) } - if src[pos:ret] == bytesNull { + if src[pos:ret] == strNull { return ret } else { return -int(types.ERR_INVALID_CHAR) @@ -287,67 +291,7 @@ func decodeValue(src string, pos int, skipnum bool) (ret int, v types.JsonState) //go:nocheckptr func skipNumber(src string, pos int) (ret int) { - sp := uintptr(rt.IndexChar(src, pos)) - se := uintptr(rt.IndexChar(src, len(src))) - if uintptr(sp) >= se { - return -int(types.ERR_EOF) - } - - if c := *(*byte)(unsafe.Pointer(sp)); c == '-' { - sp += 1 - } - ss := sp - - var pointer bool - var exponent bool - var lastIsDigit bool - var nextNeedDigit = true - - for ; sp < se; sp += uintptr(1) { - c := *(*byte)(unsafe.Pointer(sp)) - if isDigit(c) { - lastIsDigit = true - nextNeedDigit = false - continue - } else if nextNeedDigit { - return -int(types.ERR_INVALID_CHAR) - } else if c == '.' { - if !lastIsDigit || pointer || exponent || sp == ss { - return -int(types.ERR_INVALID_CHAR) - } - pointer = true - lastIsDigit = false - nextNeedDigit = true - continue - } else if c == 'e' || c == 'E' { - if !lastIsDigit || exponent { - return -int(types.ERR_INVALID_CHAR) - } - if sp == se-1 { - return -int(types.ERR_EOF) - } - exponent = true - lastIsDigit = false - nextNeedDigit = false - continue - } else if c == '-' || c == '+' { - if prev := *(*byte)(unsafe.Pointer(sp - 1)); prev != 'e' && prev != 'E' { - return -int(types.ERR_INVALID_CHAR) - } - lastIsDigit = false - nextNeedDigit = true - continue - } else { - break - } - } - - if nextNeedDigit { - return -int(types.ERR_EOF) - } - - runtime.KeepAlive(src) - return int(uintptr(sp) - uintptr((*rt.GoString)(unsafe.Pointer(&src)).Ptr)) + return utils.SkipNumber(src, pos) } //go:nocheckptr diff --git a/vendor/github.com/bytedance/sonic/ast/encode.go b/vendor/github.com/bytedance/sonic/ast/encode.go index 956809c2c..eae0bd258 100644 --- a/vendor/github.com/bytedance/sonic/ast/encode.go +++ b/vendor/github.com/bytedance/sonic/ast/encode.go @@ -17,12 +17,11 @@ package ast import ( - `sync` - `unicode/utf8` -) + "sync" + "unicode/utf8" -const ( - _MaxBuffer = 1024 // 1KB buffer size + "github.com/bytedance/sonic/internal/rt" + "github.com/bytedance/sonic/option" ) func quoteString(e *[]byte, s string) { @@ -30,7 +29,7 @@ func quoteString(e *[]byte, s string) { start := 0 for i := 0; i < len(s); { if b := s[i]; b < utf8.RuneSelf { - if safeSet[b] { + if rt.SafeSet[b] { i++ continue } @@ -54,8 +53,8 @@ func quoteString(e *[]byte, s string) { // user-controlled strings are rendered into JSON // and served to some browsers. *e = append(*e, `u00`...) - *e = append(*e, hex[b>>4]) - *e = append(*e, hex[b&0xF]) + *e = append(*e, rt.Hex[b>>4]) + *e = append(*e, rt.Hex[b&0xF]) } i++ start = i @@ -76,7 +75,7 @@ func quoteString(e *[]byte, s string) { *e = append(*e, s[start:i]...) } *e = append(*e, `\u202`...) - *e = append(*e, hex[c&0xF]) + *e = append(*e, rt.Hex[c&0xF]) i += size start = i continue @@ -92,16 +91,24 @@ func quoteString(e *[]byte, s string) { var bytesPool = sync.Pool{} func (self *Node) MarshalJSON() ([]byte, error) { + if self == nil { + return bytesNull, nil + } + buf := newBuffer() err := self.encode(buf) if err != nil { freeBuffer(buf) return nil, err } - - ret := make([]byte, len(*buf)) - copy(ret, *buf) - freeBuffer(buf) + var ret []byte + if !rt.CanSizeResue(cap(*buf)) { + ret = *buf + } else { + ret = make([]byte, len(*buf)) + copy(ret, *buf) + freeBuffer(buf) + } return ret, err } @@ -109,21 +116,24 @@ func newBuffer() *[]byte { if ret := bytesPool.Get(); ret != nil { return ret.(*[]byte) } else { - buf := make([]byte, 0, _MaxBuffer) + buf := make([]byte, 0, option.DefaultAstBufferSize) return &buf } } func freeBuffer(buf *[]byte) { + if !rt.CanSizeResue(cap(*buf)) { + return + } *buf = (*buf)[:0] bytesPool.Put(buf) } func (self *Node) encode(buf *[]byte) error { - if self.IsRaw() { + if self.isRaw() { return self.encodeRaw(buf) } - switch self.Type() { + switch int(self.itype()) { case V_NONE : return ErrNotExist case V_ERROR : return self.Check() case V_NULL : return self.encodeNull(buf) @@ -139,16 +149,21 @@ func (self *Node) encode(buf *[]byte) error { } func (self *Node) encodeRaw(buf *[]byte) error { - raw, err := self.Raw() - if err != nil { - return err + lock := self.rlock() + if !self.isRaw() { + self.runlock() + return self.encode(buf) + } + raw := self.toString() + if lock { + self.runlock() } *buf = append(*buf, raw...) return nil } func (self *Node) encodeNull(buf *[]byte) error { - *buf = append(*buf, bytesNull...) + *buf = append(*buf, strNull...) return nil } diff --git a/vendor/github.com/bytedance/sonic/ast/error.go b/vendor/github.com/bytedance/sonic/ast/error.go index 00a04468e..3716e7a91 100644 --- a/vendor/github.com/bytedance/sonic/ast/error.go +++ b/vendor/github.com/bytedance/sonic/ast/error.go @@ -17,6 +17,10 @@ func newError(err types.ParsingError, msg string) *Node { } } +func newErrorPair(err SyntaxError) *Pair { + return &Pair{0, "", *newSyntaxError(err)} +} + // Error returns error message if the node is invalid func (self Node) Error() string { if self.t != V_ERROR { @@ -79,7 +83,7 @@ func (self SyntaxError) description() string { /* check for empty source */ if self.Src == "" { - return fmt.Sprintf("no sources available: %#v", self) + return fmt.Sprintf("no sources available, the input json is empty: %#v", self) } /* prevent slicing before the beginning */ diff --git a/vendor/github.com/bytedance/sonic/ast/iterator.go b/vendor/github.com/bytedance/sonic/ast/iterator.go index 64e1e5a90..076647154 100644 --- a/vendor/github.com/bytedance/sonic/ast/iterator.go +++ b/vendor/github.com/bytedance/sonic/ast/iterator.go @@ -17,19 +17,29 @@ package ast import ( - `fmt` + "fmt" - `github.com/bytedance/sonic/internal/native/types` + "github.com/bytedance/sonic/internal/caching" + "github.com/bytedance/sonic/internal/native/types" ) type Pair struct { + hash uint64 Key string Value Node } +func NewPair(key string, val Node) Pair { + return Pair{ + hash: caching.StrHash(key), + Key: key, + Value: val, + } +} + // Values returns iterator for array's children traversal func (self *Node) Values() (ListIterator, error) { - if err := self.should(types.V_ARRAY, "an array"); err != nil { + if err := self.should(types.V_ARRAY); err != nil { return ListIterator{}, err } return self.values(), nil @@ -41,7 +51,7 @@ func (self *Node) values() ListIterator { // Properties returns iterator for object's children traversal func (self *Node) Properties() (ObjectIterator, error) { - if err := self.should(types.V_OBJECT, "an object"); err != nil { + if err := self.should(types.V_OBJECT); err != nil { return ObjectIterator{}, err } return self.properties(), nil @@ -168,6 +178,9 @@ type Scanner func(path Sequence, node *Node) bool // // NOTICE: A unsetted node WON'T trigger sc, but its index still counts into Path.Index func (self *Node) ForEach(sc Scanner) error { + if err := self.checkRaw(); err != nil { + return err + } switch self.itype() { case types.V_ARRAY: iter, err := self.Values() diff --git a/vendor/github.com/bytedance/sonic/ast/node.go b/vendor/github.com/bytedance/sonic/ast/node.go index ac6d22808..0fbcf7835 100644 --- a/vendor/github.com/bytedance/sonic/ast/node.go +++ b/vendor/github.com/bytedance/sonic/ast/node.go @@ -17,13 +17,15 @@ package ast import ( - `encoding/json` - `fmt` - `strconv` - `unsafe` - - `github.com/bytedance/sonic/internal/native/types` - `github.com/bytedance/sonic/internal/rt` + "encoding/json" + "fmt" + "strconv" + "sync" + "sync/atomic" + "unsafe" + + "github.com/bytedance/sonic/internal/native/types" + "github.com/bytedance/sonic/internal/rt" ) const ( @@ -36,7 +38,7 @@ const ( _V_ARRAY_LAZY = _V_LAZY | types.V_ARRAY _V_OBJECT_LAZY = _V_LAZY | types.V_OBJECT _MASK_LAZY = _V_LAZY - 1 - _MASK_RAW = _V_RAW - 1 + _MASK_RAW = _V_RAW - 1 ) const ( @@ -56,6 +58,7 @@ type Node struct { t types.ValueType l uint p unsafe.Pointer + m *sync.RWMutex } // UnmarshalJSON is just an adapter to json.Unmarshaler. @@ -79,17 +82,39 @@ func (self *Node) UnmarshalJSON(data []byte) (err error) { // V_STRING = 7 (json value string) // V_NUMBER = 33 (json value number ) // V_ANY = 34 (golang interface{}) +// +// Deprecated: not concurrent safe. Use TypeSafe instead func (self Node) Type() int { return int(self.t & _MASK_LAZY & _MASK_RAW) } -func (self Node) itype() types.ValueType { +// Type concurrently-safe returns json type represented by the node +// It will be one of belows: +// V_NONE = 0 (empty node, key not exists) +// V_ERROR = 1 (error node) +// V_NULL = 2 (json value `null`, key exists) +// V_TRUE = 3 (json value `true`) +// V_FALSE = 4 (json value `false`) +// V_ARRAY = 5 (json value array) +// V_OBJECT = 6 (json value object) +// V_STRING = 7 (json value string) +// V_NUMBER = 33 (json value number ) +// V_ANY = 34 (golang interface{}) +func (self *Node) TypeSafe() int { + return int(self.loadt() & _MASK_LAZY & _MASK_RAW) +} + +func (self *Node) itype() types.ValueType { return self.t & _MASK_LAZY & _MASK_RAW } // Exists returns false only if the self is nil or empty node V_NONE func (self *Node) Exists() bool { - return self.Valid() && self.t != _V_NONE + if self == nil { + return false + } + t := self.loadt() + return t != V_ERROR && t != _V_NONE } // Valid reports if self is NOT V_ERROR or nil @@ -97,7 +122,7 @@ func (self *Node) Valid() bool { if self == nil { return false } - return self.t != V_ERROR + return self.loadt() != V_ERROR } // Check checks if the node itself is valid, and return: @@ -106,24 +131,31 @@ func (self *Node) Valid() bool { func (self *Node) Check() error { if self == nil { return ErrNotExist - } else if self.t != V_ERROR { + } else if self.loadt() != V_ERROR { return nil } else { return self } } -// IsRaw returns true if node's underlying value is raw json +// isRaw returns true if node's underlying value is raw json +// +// Deprecated: not concurent safe func (self Node) IsRaw() bool { - return self.t&_V_RAW != 0 + return self.t & _V_RAW != 0 +} + +// IsRaw returns true if node's underlying value is raw json +func (self *Node) isRaw() bool { + return self.loadt() & _V_RAW != 0 } func (self *Node) isLazy() bool { - return self != nil && self.t&_V_LAZY != 0 + return self != nil && self.t & _V_LAZY != 0 } func (self *Node) isAny() bool { - return self != nil && self.t == _V_ANY + return self != nil && self.loadt() == _V_ANY } /** Simple Value Methods **/ @@ -133,18 +165,26 @@ func (self *Node) Raw() (string, error) { if self == nil { return "", ErrNotExist } - if !self.IsRaw() { + lock := self.rlock() + if !self.isRaw() { + if lock { + self.runlock() + } buf, err := self.MarshalJSON() return rt.Mem2Str(buf), err } - return self.toString(), nil + ret := self.toString() + if lock { + self.runlock() + } + return ret, nil } func (self *Node) checkRaw() error { if err := self.Check(); err != nil { return err } - if self.IsRaw() { + if self.isRaw() { self.parseRaw(false) } return self.Check() @@ -504,7 +544,7 @@ func (self *Node) Len() (int, error) { } } -func (self Node) len() int { +func (self *Node) len() int { return int(self.l) } @@ -527,7 +567,7 @@ func (self *Node) Cap() (int, error) { // // If self is V_NONE or V_NULL, it becomes V_OBJECT and sets the node at the key. func (self *Node) Set(key string, node Node) (bool, error) { - if err := self.Check(); err != nil { + if err := self.checkRaw(); err != nil { return false, err } if err := node.Check(); err != nil { @@ -535,7 +575,7 @@ func (self *Node) Set(key string, node Node) (bool, error) { } if self.t == _V_NONE || self.t == types.V_NULL { - *self = NewObject([]Pair{{key, node}}) + *self = NewObject([]Pair{NewPair(key, node)}) return false, nil } else if self.itype() != types.V_OBJECT { return false, ErrUnsupportType @@ -549,7 +589,7 @@ func (self *Node) Set(key string, node Node) (bool, error) { *self = newObject(new(linkedPairs)) } s := (*linkedPairs)(self.p) - s.Push(Pair{key, node}) + s.Push(NewPair(key, node)) self.l++ return false, nil @@ -568,7 +608,7 @@ func (self *Node) SetAny(key string, val interface{}) (bool, error) { // Unset REMOVE (soft) the node of given key under object parent, and reports if the key has existed. func (self *Node) Unset(key string) (bool, error) { - if err := self.should(types.V_OBJECT, "an object"); err != nil { + if err := self.should(types.V_OBJECT); err != nil { return false, err } // NOTICE: must get acurate length before deduct @@ -589,7 +629,7 @@ func (self *Node) Unset(key string) (bool, error) { // // The index must be within self's children. func (self *Node) SetByIndex(index int, node Node) (bool, error) { - if err := self.Check(); err != nil { + if err := self.checkRaw(); err != nil { return false, err } if err := node.Check(); err != nil { @@ -669,7 +709,7 @@ func (self *Node) UnsetByIndex(index int) (bool, error) { // // If self is V_NONE or V_NULL, it becomes V_ARRAY and sets the node at index 0. func (self *Node) Add(node Node) error { - if err := self.Check(); err != nil { + if err := self.checkRaw(); err != nil { return err } @@ -677,7 +717,7 @@ func (self *Node) Add(node Node) error { *self = NewArray([]Node{node}) return nil } - if err := self.should(types.V_ARRAY, "an array"); err != nil { + if err := self.should(types.V_ARRAY); err != nil { return err } @@ -740,7 +780,7 @@ func (self *Node) Pop() error { // // WARN: this will change address of elements, which is a dangerous action. func (self *Node) Move(dst, src int) error { - if err := self.should(types.V_ARRAY, "an array"); err != nil { + if err := self.should(types.V_ARRAY); err != nil { return err } @@ -812,7 +852,7 @@ func (self *Node) GetByPath(path ...interface{}) *Node { // Get loads given key of an object node on demands func (self *Node) Get(key string) *Node { - if err := self.should(types.V_OBJECT, "an object"); err != nil { + if err := self.should(types.V_OBJECT); err != nil { return unwrapError(err) } n, _ := self.skipKey(key) @@ -845,14 +885,14 @@ func (self *Node) Index(idx int) *Node { // IndexPair indexies pair at given idx, // node type MUST be either V_OBJECT func (self *Node) IndexPair(idx int) *Pair { - if err := self.should(types.V_OBJECT, "an object"); err != nil { + if err := self.should(types.V_OBJECT); err != nil { return nil } return self.skipIndexPair(idx) } func (self *Node) indexOrGet(idx int, key string) (*Node, int) { - if err := self.should(types.V_OBJECT, "an object"); err != nil { + if err := self.should(types.V_OBJECT); err != nil { return unwrapError(err), idx } @@ -889,10 +929,10 @@ func (self *Node) Map() (map[string]interface{}, error) { return nil, ErrUnsupportType } } - if err := self.should(types.V_OBJECT, "an object"); err != nil { + if err := self.should(types.V_OBJECT); err != nil { return nil, err } - if err := self.loadAllKey(); err != nil { + if err := self.loadAllKey(false); err != nil { return nil, err } return self.toGenericObject() @@ -908,10 +948,10 @@ func (self *Node) MapUseNumber() (map[string]interface{}, error) { return nil, ErrUnsupportType } } - if err := self.should(types.V_OBJECT, "an object"); err != nil { + if err := self.should(types.V_OBJECT); err != nil { return nil, err } - if err := self.loadAllKey(); err != nil { + if err := self.loadAllKey(false); err != nil { return nil, err } return self.toGenericObjectUseNumber() @@ -928,7 +968,7 @@ func (self *Node) MapUseNode() (map[string]Node, error) { return nil, ErrUnsupportType } } - if err := self.should(types.V_OBJECT, "an object"); err != nil { + if err := self.should(types.V_OBJECT); err != nil { return nil, err } if err := self.skipAllKey(); err != nil { @@ -1034,10 +1074,10 @@ func (self *Node) Array() ([]interface{}, error) { return nil, ErrUnsupportType } } - if err := self.should(types.V_ARRAY, "an array"); err != nil { + if err := self.should(types.V_ARRAY); err != nil { return nil, err } - if err := self.loadAllIndex(); err != nil { + if err := self.loadAllIndex(false); err != nil { return nil, err } return self.toGenericArray() @@ -1053,10 +1093,10 @@ func (self *Node) ArrayUseNumber() ([]interface{}, error) { return nil, ErrUnsupportType } } - if err := self.should(types.V_ARRAY, "an array"); err != nil { + if err := self.should(types.V_ARRAY); err != nil { return nil, err } - if err := self.loadAllIndex(); err != nil { + if err := self.loadAllIndex(false); err != nil { return nil, err } return self.toGenericArrayUseNumber() @@ -1073,7 +1113,7 @@ func (self *Node) ArrayUseNode() ([]Node, error) { return nil, ErrUnsupportType } } - if err := self.should(types.V_ARRAY, "an array"); err != nil { + if err := self.should(types.V_ARRAY); err != nil { return nil, err } if err := self.skipAllIndex(); err != nil { @@ -1129,12 +1169,12 @@ func (self *Node) Interface() (interface{}, error) { } return v, nil case _V_ARRAY_LAZY : - if err := self.loadAllIndex(); err != nil { + if err := self.loadAllIndex(false); err != nil { return nil, err } return self.toGenericArray() case _V_OBJECT_LAZY : - if err := self.loadAllKey(); err != nil { + if err := self.loadAllKey(false); err != nil { return nil, err } return self.toGenericObject() @@ -1168,12 +1208,12 @@ func (self *Node) InterfaceUseNumber() (interface{}, error) { case types.V_STRING : return self.toString(), nil case _V_NUMBER : return self.toNumber(), nil case _V_ARRAY_LAZY : - if err := self.loadAllIndex(); err != nil { + if err := self.loadAllIndex(false); err != nil { return nil, err } return self.toGenericArrayUseNumber() case _V_OBJECT_LAZY : - if err := self.loadAllKey(); err != nil { + if err := self.loadAllKey(false); err != nil { return nil, err } return self.toGenericObjectUseNumber() @@ -1205,70 +1245,30 @@ func (self *Node) InterfaceUseNode() (interface{}, error) { } } -// LoadAll loads all the node's children and children's children as parsed. -// After calling it, the node can be safely used on concurrency +// LoadAll loads the node's children +// and ensure all its children can be READ concurrently (include its children's children) func (self *Node) LoadAll() error { - if self.IsRaw() { - self.parseRaw(true) - return self.Check() - } - - switch self.itype() { - case types.V_ARRAY: - e := self.len() - if err := self.loadAllIndex(); err != nil { - return err - } - for i := 0; i < e; i++ { - n := self.nodeAt(i) - if n.IsRaw() { - n.parseRaw(true) - } - if err := n.Check(); err != nil { - return err - } - } - return nil - case types.V_OBJECT: - e := self.len() - if err := self.loadAllKey(); err != nil { - return err - } - for i := 0; i < e; i++ { - n := self.pairAt(i) - if n.Value.IsRaw() { - n.Value.parseRaw(true) - } - if err := n.Value.Check(); err != nil { - return err - } - } - return nil - default: - return self.Check() - } + return self.Load() } // Load loads the node's children as parsed. -// After calling it, only the node itself can be used on concurrency (not include its children) +// and ensure all its children can be READ concurrently (include its children's children) func (self *Node) Load() error { - if err := self.checkRaw(); err != nil { - return err - } - switch self.t { - case _V_ARRAY_LAZY: - return self.skipAllIndex() - case _V_OBJECT_LAZY: - return self.skipAllKey() - default: - return self.Check() + case _V_ARRAY_LAZY: self.loadAllIndex(true) + case _V_OBJECT_LAZY: self.loadAllKey(true) + case V_ERROR: return self + case V_NONE: return nil } + if self.m == nil { + self.m = new(sync.RWMutex) + } + return self.checkRaw() } /**---------------------------------- Internal Helper Methods ----------------------------------**/ -func (self *Node) should(t types.ValueType, s string) error { +func (self *Node) should(t types.ValueType) error { if err := self.checkRaw(); err != nil { return err } @@ -1439,13 +1439,17 @@ func (self *Node) skipIndexPair(index int) *Pair { return nil } -func (self *Node) loadAllIndex() error { +func (self *Node) loadAllIndex(loadOnce bool) error { if !self.isLazy() { return nil } var err types.ParsingError parser, stack := self.getParserAndArrayStack() - parser.noLazy = true + if !loadOnce { + parser.noLazy = true + } else { + parser.loadOnce = true + } *self, err = parser.decodeArray(&stack.v) if err != 0 { return parser.ExportError(err) @@ -1453,14 +1457,19 @@ func (self *Node) loadAllIndex() error { return nil } -func (self *Node) loadAllKey() error { +func (self *Node) loadAllKey(loadOnce bool) error { if !self.isLazy() { return nil } var err types.ParsingError parser, stack := self.getParserAndObjectStack() - parser.noLazy = true - *self, err = parser.decodeObject(&stack.v) + if !loadOnce { + parser.noLazy = true + *self, err = parser.decodeObject(&stack.v) + } else { + parser.loadOnce = true + *self, err = parser.decodeObject(&stack.v) + } if err != 0 { return parser.ExportError(err) } @@ -1629,7 +1638,23 @@ func NewRaw(json string) Node { if it == _V_NONE { return Node{} } - return newRawNode(parser.s[start:parser.p], it) + return newRawNode(parser.s[start:parser.p], it, false) +} + +// NewRawConcurrentRead creates a node of raw json, which can be READ +// (GetByPath/Get/Index/GetOrIndex/Int64/Bool/Float64/String/Number/Interface/Array/Map/Raw/MarshalJSON) concurrently. +// If the input json is invalid, NewRaw returns a error Node. +func NewRawConcurrentRead(json string) Node { + parser := NewParserObj(json) + start, err := parser.skip() + if err != 0 { + return *newError(err, err.Message()) + } + it := switchRawType(parser.s[start]) + if it == _V_NONE { + return Node{} + } + return newRawNode(parser.s[start:parser.p], it, true) } // NewAny creates a node of type V_ANY if any's type isn't Node or *Node, @@ -1653,7 +1678,7 @@ func NewBytes(src []byte) Node { if len(src) == 0 { panic("empty src bytes") } - out := encodeBase64(src) + out := rt.EncodeBase64(src) return NewString(out) } @@ -1689,15 +1714,15 @@ func NewNumber(v string) Node { } } -func (node Node) toNumber() json.Number { +func (node *Node) toNumber() json.Number { return json.Number(rt.StrFrom(node.p, int64(node.l))) } -func (self Node) toString() string { +func (self *Node) toString() string { return rt.StrFrom(self.p, int64(self.l)) } -func (node Node) toFloat64() (float64, error) { +func (node *Node) toFloat64() (float64, error) { ret, err := node.toNumber().Float64() if err != nil { return 0, err @@ -1705,7 +1730,7 @@ func (node Node) toFloat64() (float64, error) { return ret, nil } -func (node Node) toInt64() (int64, error) { +func (node *Node) toInt64() (int64, error) { ret,err := node.toNumber().Int64() if err != nil { return 0, err @@ -1741,6 +1766,8 @@ func NewArray(v []Node) Node { return newArray(s) } +const _Threshold_Index = 16 + func newArray(v *linkedNodes) Node { return Node{ t: types.V_ARRAY, @@ -1764,6 +1791,9 @@ func NewObject(v []Pair) Node { } func newObject(v *linkedPairs) Node { + if v.size > _Threshold_Index { + v.BuildIndex() + } return Node{ t: types.V_OBJECT, l: uint(v.Len()), @@ -1772,53 +1802,42 @@ func newObject(v *linkedPairs) Node { } func (self *Node) setObject(v *linkedPairs) { + if v.size > _Threshold_Index { + v.BuildIndex() + } self.t = types.V_OBJECT self.l = uint(v.Len()) self.p = unsafe.Pointer(v) } -func newRawNode(str string, typ types.ValueType) Node { - return Node{ - t: _V_RAW | typ, - p: rt.StrPtr(str), - l: uint(len(str)), - } -} - func (self *Node) parseRaw(full bool) { + lock := self.lock() + defer self.unlock() + if !self.isRaw() { + return + } raw := self.toString() parser := NewParserObj(raw) + var e types.ParsingError if full { parser.noLazy = true - parser.skipValue = false + *self, e = parser.Parse() + } else if lock { + var n Node + parser.noLazy = true + parser.loadOnce = true + n, e = parser.Parse() + self.assign(n) + } else { + *self, e = parser.Parse() } - var e types.ParsingError - *self, e = parser.Parse() if e != 0 { *self = *newSyntaxError(parser.syntaxError(e)) } } -var typeJumpTable = [256]types.ValueType{ - '"' : types.V_STRING, - '-' : _V_NUMBER, - '0' : _V_NUMBER, - '1' : _V_NUMBER, - '2' : _V_NUMBER, - '3' : _V_NUMBER, - '4' : _V_NUMBER, - '5' : _V_NUMBER, - '6' : _V_NUMBER, - '7' : _V_NUMBER, - '8' : _V_NUMBER, - '9' : _V_NUMBER, - '[' : types.V_ARRAY, - 'f' : types.V_FALSE, - 'n' : types.V_NULL, - 't' : types.V_TRUE, - '{' : types.V_OBJECT, -} - -func switchRawType(c byte) types.ValueType { - return typeJumpTable[c] +func (self *Node) assign(n Node) { + self.l = n.l + self.p = n.p + atomic.StoreInt64(&self.t, n.t) } diff --git a/vendor/github.com/bytedance/sonic/ast/parser.go b/vendor/github.com/bytedance/sonic/ast/parser.go index a1f582623..30bd1f451 100644 --- a/vendor/github.com/bytedance/sonic/ast/parser.go +++ b/vendor/github.com/bytedance/sonic/ast/parser.go @@ -17,14 +17,16 @@ package ast import ( - `fmt` + "fmt" + "sync" + "sync/atomic" - `github.com/bytedance/sonic/internal/native/types` - `github.com/bytedance/sonic/internal/rt` + "github.com/bytedance/sonic/internal/native/types" + "github.com/bytedance/sonic/internal/rt" ) const ( - _DEFAULT_NODE_CAP int = 8 + _DEFAULT_NODE_CAP int = 16 _APPEND_GROW_SHIFT = 1 ) @@ -45,6 +47,7 @@ type Parser struct { p int s string noLazy bool + loadOnce bool skipValue bool dbuf *byte } @@ -115,6 +118,10 @@ func (self *Parser) lspace(sp int) int { return sp } +func (self *Parser) backward() { + for ; self.p >= 0 && isSpace(self.s[self.p]); self.p-=1 {} +} + func (self *Parser) decodeArray(ret *linkedNodes) (Node, types.ParsingError) { sp := self.p ns := len(self.s) @@ -148,7 +155,7 @@ func (self *Parser) decodeArray(ret *linkedNodes) (Node, types.ParsingError) { if t == _V_NONE { return Node{}, types.ERR_INVALID_CHAR } - val = newRawNode(self.s[start:self.p], t) + val = newRawNode(self.s[start:self.p], t, false) }else{ /* decode the value */ if val, err = self.Parse(); err != 0 { @@ -234,7 +241,7 @@ func (self *Parser) decodeObject(ret *linkedPairs) (Node, types.ParsingError) { if t == _V_NONE { return Node{}, types.ERR_INVALID_CHAR } - val = newRawNode(self.s[start:self.p], t) + val = newRawNode(self.s[start:self.p], t, false) } else { /* decode the value */ if val, err = self.Parse(); err != 0 { @@ -244,7 +251,7 @@ func (self *Parser) decodeObject(ret *linkedPairs) (Node, types.ParsingError) { /* add the value to result */ // FIXME: ret's address may change here, thus previous referred node in ret may be invalid !! - ret.Push(Pair{Key: key, Value: val}) + ret.Push(NewPair(key, val)) self.p = self.lspace(self.p) /* check for EOF */ @@ -291,6 +298,10 @@ func (self *Parser) Pos() int { return self.p } + +// Parse returns a ast.Node representing the parser's JSON. +// NOTICE: the specific parsing lazy dependens parser's option +// It only parse first layer and first child for Object or Array be default func (self *Parser) Parse() (Node, types.ParsingError) { switch val := self.decodeValue(); val.Vt { case types.V_EOF : return Node{}, types.ERR_EOF @@ -299,22 +310,48 @@ func (self *Parser) Parse() (Node, types.ParsingError) { case types.V_FALSE : return falseNode, 0 case types.V_STRING : return self.decodeString(val.Iv, val.Ep) case types.V_ARRAY: + s := self.p - 1; if p := skipBlank(self.s, self.p); p >= self.p && self.s[p] == ']' { self.p = p + 1 return Node{t: types.V_ARRAY}, 0 } if self.noLazy { + if self.loadOnce { + self.noLazy = false + } return self.decodeArray(new(linkedNodes)) } + // NOTICE: loadOnce always keep raw json for object or array + if self.loadOnce { + self.p = s + s, e := self.skipFast() + if e != 0 { + return Node{}, e + } + return newRawNode(self.s[s:self.p], types.V_ARRAY, true), 0 + } return newLazyArray(self), 0 case types.V_OBJECT: + s := self.p - 1; if p := skipBlank(self.s, self.p); p >= self.p && self.s[p] == '}' { self.p = p + 1 return Node{t: types.V_OBJECT}, 0 } + // NOTICE: loadOnce always keep raw json for object or array if self.noLazy { + if self.loadOnce { + self.noLazy = false + } return self.decodeObject(new(linkedPairs)) } + if self.loadOnce { + self.p = s + s, e := self.skipFast() + if e != 0 { + return Node{}, e + } + return newRawNode(self.s[s:self.p], types.V_OBJECT, true), 0 + } return newLazyObject(self), 0 case types.V_DOUBLE : return NewNumber(self.s[val.Ep:self.p]), 0 case types.V_INTEGER : return NewNumber(self.s[val.Ep:self.p]), 0 @@ -471,7 +508,7 @@ func (self *Node) skipNextNode() *Node { if t == _V_NONE { return newSyntaxError(parser.syntaxError(types.ERR_INVALID_CHAR)) } - val = newRawNode(parser.s[start:parser.p], t) + val = newRawNode(parser.s[start:parser.p], t, false) } /* add the value to result */ @@ -510,7 +547,7 @@ func (self *Node) skipNextPair() (*Pair) { /* check for EOF */ if parser.p = parser.lspace(sp); parser.p >= ns { - return &Pair{"", *newSyntaxError(parser.syntaxError(types.ERR_EOF))} + return newErrorPair(parser.syntaxError(types.ERR_EOF)) } /* check for empty object */ @@ -527,7 +564,7 @@ func (self *Node) skipNextPair() (*Pair) { /* decode the key */ if njs = parser.decodeValue(); njs.Vt != types.V_STRING { - return &Pair{"", *newSyntaxError(parser.syntaxError(types.ERR_INVALID_CHAR))} + return newErrorPair(parser.syntaxError(types.ERR_INVALID_CHAR)) } /* extract the key */ @@ -537,34 +574,34 @@ func (self *Node) skipNextPair() (*Pair) { /* check for escape sequence */ if njs.Ep != -1 { if key, err = unquote(key); err != 0 { - return &Pair{key, *newSyntaxError(parser.syntaxError(err))} + return newErrorPair(parser.syntaxError(err)) } } /* expect a ':' delimiter */ if err = parser.delim(); err != 0 { - return &Pair{key, *newSyntaxError(parser.syntaxError(err))} + return newErrorPair(parser.syntaxError(err)) } /* skip the value */ if start, err := parser.skipFast(); err != 0 { - return &Pair{key, *newSyntaxError(parser.syntaxError(err))} + return newErrorPair(parser.syntaxError(err)) } else { t := switchRawType(parser.s[start]) if t == _V_NONE { - return &Pair{key, *newSyntaxError(parser.syntaxError(types.ERR_INVALID_CHAR))} + return newErrorPair(parser.syntaxError(types.ERR_INVALID_CHAR)) } - val = newRawNode(parser.s[start:parser.p], t) + val = newRawNode(parser.s[start:parser.p], t, false) } /* add the value to result */ - ret.Push(Pair{Key: key, Value: val}) + ret.Push(NewPair(key, val)) self.l++ parser.p = parser.lspace(parser.p) /* check for EOF */ if parser.p >= ns { - return &Pair{key, *newSyntaxError(parser.syntaxError(types.ERR_EOF))} + return newErrorPair(parser.syntaxError(types.ERR_EOF)) } /* check for the next character */ @@ -577,7 +614,7 @@ func (self *Node) skipNextPair() (*Pair) { self.setObject(ret) return ret.At(ret.Len()-1) default: - return &Pair{key, *newSyntaxError(parser.syntaxError(types.ERR_INVALID_CHAR))} + return newErrorPair(parser.syntaxError(types.ERR_INVALID_CHAR)) } } @@ -658,3 +695,72 @@ func backward(src string, i int) int { for ; i>=0 && isSpace(src[i]); i-- {} return i } + + +func newRawNode(str string, typ types.ValueType, lock bool) Node { + ret := Node{ + t: typ | _V_RAW, + p: rt.StrPtr(str), + l: uint(len(str)), + } + if lock { + ret.m = new(sync.RWMutex) + } + return ret +} + +var typeJumpTable = [256]types.ValueType{ + '"' : types.V_STRING, + '-' : _V_NUMBER, + '0' : _V_NUMBER, + '1' : _V_NUMBER, + '2' : _V_NUMBER, + '3' : _V_NUMBER, + '4' : _V_NUMBER, + '5' : _V_NUMBER, + '6' : _V_NUMBER, + '7' : _V_NUMBER, + '8' : _V_NUMBER, + '9' : _V_NUMBER, + '[' : types.V_ARRAY, + 'f' : types.V_FALSE, + 'n' : types.V_NULL, + 't' : types.V_TRUE, + '{' : types.V_OBJECT, +} + +func switchRawType(c byte) types.ValueType { + return typeJumpTable[c] +} + +func (self *Node) loadt() types.ValueType { + return (types.ValueType)(atomic.LoadInt64(&self.t)) +} + +func (self *Node) lock() bool { + if m := self.m; m != nil { + m.Lock() + return true + } + return false +} + +func (self *Node) unlock() { + if m := self.m; m != nil { + m.Unlock() + } +} + +func (self *Node) rlock() bool { + if m := self.m; m != nil { + m.RLock() + return true + } + return false +} + +func (self *Node) runlock() { + if m := self.m; m != nil { + m.RUnlock() + } +} diff --git a/vendor/github.com/bytedance/sonic/ast/search.go b/vendor/github.com/bytedance/sonic/ast/search.go index a8d1e76f6..9a5fb9420 100644 --- a/vendor/github.com/bytedance/sonic/ast/search.go +++ b/vendor/github.com/bytedance/sonic/ast/search.go @@ -21,8 +21,23 @@ import ( `github.com/bytedance/sonic/internal/native/types` ) +// SearchOptions controls Searcher's behavior +type SearchOptions struct { + // ValidateJSON indicates the searcher to validate the entire JSON + ValidateJSON bool + + // CopyReturn indicates the searcher to copy the result JSON instead of refer from the input + // This can help to reduce memory usage if you cache the results + CopyReturn bool + + // ConcurrentRead indicates the searcher to return a concurrently-READ-safe node, + // including: GetByPath/Get/Index/GetOrIndex/Int64/Bool/Float64/String/Number/Interface/Array/Map/Raw/MarshalJSON + ConcurrentRead bool +} + type Searcher struct { parser Parser + SearchOptions } func NewSearcher(str string) *Searcher { @@ -31,12 +46,16 @@ func NewSearcher(str string) *Searcher { s: str, noLazy: false, }, + SearchOptions: SearchOptions{ + ValidateJSON: true, + }, } } // GetByPathCopy search in depth from top json and returns a **Copied** json node at the path location func (self *Searcher) GetByPathCopy(path ...interface{}) (Node, error) { - return self.getByPath(true, true, path...) + self.CopyReturn = true + return self.getByPath(path...) } // GetByPathNoCopy search in depth from top json and returns a **Referenced** json node at the path location @@ -44,15 +63,15 @@ func (self *Searcher) GetByPathCopy(path ...interface{}) (Node, error) { // WARN: this search directly refer partial json from top json, which has faster speed, // may consumes more memory. func (self *Searcher) GetByPath(path ...interface{}) (Node, error) { - return self.getByPath(false, true, path...) + return self.getByPath(path...) } -func (self *Searcher) getByPath(copystring bool, validate bool, path ...interface{}) (Node, error) { +func (self *Searcher) getByPath(path ...interface{}) (Node, error) { var err types.ParsingError var start int self.parser.p = 0 - start, err = self.parser.getByPath(validate, path...) + start, err = self.parser.getByPath(self.ValidateJSON, path...) if err != 0 { // for compatibility with old version if err == types.ERR_NOT_FOUND { @@ -71,12 +90,12 @@ func (self *Searcher) getByPath(copystring bool, validate bool, path ...interfac // copy string to reducing memory usage var raw string - if copystring { + if self.CopyReturn { raw = rt.Mem2Str([]byte(self.parser.s[start:self.parser.p])) } else { raw = self.parser.s[start:self.parser.p] } - return newRawNode(raw, t), nil + return newRawNode(raw, t, self.ConcurrentRead), nil } // GetByPath searches a path and returns relaction and types of target diff --git a/vendor/github.com/bytedance/sonic/ast/stubs.go b/vendor/github.com/bytedance/sonic/ast/stubs.go new file mode 100644 index 000000000..53bf3b8aa --- /dev/null +++ b/vendor/github.com/bytedance/sonic/ast/stubs.go @@ -0,0 +1,142 @@ +/* + * Copyright 2021 ByteDance Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ast + +import ( + "unicode/utf8" + "unsafe" + + "github.com/bytedance/sonic/internal/rt" +) + +//go:noescape +//go:linkname memmove runtime.memmove +//goland:noinspection GoUnusedParameter +func memmove(to unsafe.Pointer, from unsafe.Pointer, n uintptr) + +//go:linkname unsafe_NewArray reflect.unsafe_NewArray +//goland:noinspection GoUnusedParameter +func unsafe_NewArray(typ *rt.GoType, n int) unsafe.Pointer + +//go:nosplit +func mem2ptr(s []byte) unsafe.Pointer { + return (*rt.GoSlice)(unsafe.Pointer(&s)).Ptr +} + +var safeSet = [utf8.RuneSelf]bool{ + ' ': true, + '!': true, + '"': false, + '#': true, + '$': true, + '%': true, + '&': true, + '\'': true, + '(': true, + ')': true, + '*': true, + '+': true, + ',': true, + '-': true, + '.': true, + '/': true, + '0': true, + '1': true, + '2': true, + '3': true, + '4': true, + '5': true, + '6': true, + '7': true, + '8': true, + '9': true, + ':': true, + ';': true, + '<': true, + '=': true, + '>': true, + '?': true, + '@': true, + 'A': true, + 'B': true, + 'C': true, + 'D': true, + 'E': true, + 'F': true, + 'G': true, + 'H': true, + 'I': true, + 'J': true, + 'K': true, + 'L': true, + 'M': true, + 'N': true, + 'O': true, + 'P': true, + 'Q': true, + 'R': true, + 'S': true, + 'T': true, + 'U': true, + 'V': true, + 'W': true, + 'X': true, + 'Y': true, + 'Z': true, + '[': true, + '\\': false, + ']': true, + '^': true, + '_': true, + '`': true, + 'a': true, + 'b': true, + 'c': true, + 'd': true, + 'e': true, + 'f': true, + 'g': true, + 'h': true, + 'i': true, + 'j': true, + 'k': true, + 'l': true, + 'm': true, + 'n': true, + 'o': true, + 'p': true, + 'q': true, + 'r': true, + 's': true, + 't': true, + 'u': true, + 'v': true, + 'w': true, + 'x': true, + 'y': true, + 'z': true, + '{': true, + '|': true, + '}': true, + '~': true, + '\u007f': true, +} + +var hex = "0123456789abcdef" + +//go:linkname unquoteBytes encoding/json.unquoteBytes +func unquoteBytes(s []byte) (t []byte, ok bool) diff --git a/vendor/github.com/bytedance/sonic/ast/stubs_go115.go b/vendor/github.com/bytedance/sonic/ast/stubs_go115.go deleted file mode 100644 index 37b9451f0..000000000 --- a/vendor/github.com/bytedance/sonic/ast/stubs_go115.go +++ /dev/null @@ -1,55 +0,0 @@ -// +build !go1.20 - -/* - * Copyright 2021 ByteDance Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ast - -import ( - `unsafe` - `unicode/utf8` - - `github.com/bytedance/sonic/internal/rt` -) - -//go:noescape -//go:linkname memmove runtime.memmove -//goland:noinspection GoUnusedParameter -func memmove(to unsafe.Pointer, from unsafe.Pointer, n uintptr) - -//go:linkname unsafe_NewArray reflect.unsafe_NewArray -//goland:noinspection GoUnusedParameter -func unsafe_NewArray(typ *rt.GoType, n int) unsafe.Pointer - -//go:linkname growslice runtime.growslice -//goland:noinspection GoUnusedParameter -func growslice(et *rt.GoType, old rt.GoSlice, cap int) rt.GoSlice - -//go:nosplit -func mem2ptr(s []byte) unsafe.Pointer { - return (*rt.GoSlice)(unsafe.Pointer(&s)).Ptr -} - -var ( - //go:linkname safeSet encoding/json.safeSet - safeSet [utf8.RuneSelf]bool - - //go:linkname hex encoding/json.hex - hex string -) - -//go:linkname unquoteBytes encoding/json.unquoteBytes -func unquoteBytes(s []byte) (t []byte, ok bool) \ No newline at end of file diff --git a/vendor/github.com/bytedance/sonic/ast/stubs_go120.go b/vendor/github.com/bytedance/sonic/ast/stubs_go120.go deleted file mode 100644 index 6f830529d..000000000 --- a/vendor/github.com/bytedance/sonic/ast/stubs_go120.go +++ /dev/null @@ -1,55 +0,0 @@ -// +build go1.20 - -/* - * Copyright 2021 ByteDance Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ast - -import ( - `unsafe` - `unicode/utf8` - - `github.com/bytedance/sonic/internal/rt` -) - -//go:noescape -//go:linkname memmove runtime.memmove -//goland:noinspection GoUnusedParameter -func memmove(to unsafe.Pointer, from unsafe.Pointer, n uintptr) - -//go:linkname unsafe_NewArray reflect.unsafe_NewArray -//goland:noinspection GoUnusedParameter -func unsafe_NewArray(typ *rt.GoType, n int) unsafe.Pointer - -//go:linkname growslice reflect.growslice -//goland:noinspection GoUnusedParameter -func growslice(et *rt.GoType, old rt.GoSlice, cap int) rt.GoSlice - -//go:nosplit -func mem2ptr(s []byte) unsafe.Pointer { - return (*rt.GoSlice)(unsafe.Pointer(&s)).Ptr -} - -var ( - //go:linkname safeSet encoding/json.safeSet - safeSet [utf8.RuneSelf]bool - - //go:linkname hex encoding/json.hex - hex string -) - -//go:linkname unquoteBytes encoding/json.unquoteBytes -func unquoteBytes(s []byte) (t []byte, ok bool) diff --git a/vendor/github.com/bytedance/sonic/ast/visitor.go b/vendor/github.com/bytedance/sonic/ast/visitor.go index d409509f5..dc0478513 100644 --- a/vendor/github.com/bytedance/sonic/ast/visitor.go +++ b/vendor/github.com/bytedance/sonic/ast/visitor.go @@ -18,6 +18,7 @@ package ast import ( `encoding/json` + `errors` `github.com/bytedance/sonic/internal/native/types` ) @@ -174,6 +175,19 @@ func (self *traverser) decodeArray() error { sp := self.parser.p ns := len(self.parser.s) + /* allocate array space and parse every element */ + if err := self.visitor.OnArrayBegin(_DEFAULT_NODE_CAP); err != nil { + if err == VisitOPSkip { + // NOTICE: for user needs to skip entiry object + self.parser.p -= 1 + if _, e := self.parser.skipFast(); e != 0 { + return e + } + return self.visitor.OnArrayEnd() + } + return err + } + /* check for EOF */ self.parser.p = self.parser.lspace(sp) if self.parser.p >= ns { @@ -183,16 +197,9 @@ func (self *traverser) decodeArray() error { /* check for empty array */ if self.parser.s[self.parser.p] == ']' { self.parser.p++ - if err := self.visitor.OnArrayBegin(0); err != nil { - return err - } return self.visitor.OnArrayEnd() } - /* allocate array space and parse every element */ - if err := self.visitor.OnArrayBegin(_DEFAULT_NODE_CAP); err != nil { - return err - } for { /* decode the value */ if err := self.decodeValue(); err != nil { @@ -223,6 +230,19 @@ func (self *traverser) decodeObject() error { sp := self.parser.p ns := len(self.parser.s) + /* allocate object space and decode each pair */ + if err := self.visitor.OnObjectBegin(_DEFAULT_NODE_CAP); err != nil { + if err == VisitOPSkip { + // NOTICE: for user needs to skip entiry object + self.parser.p -= 1 + if _, e := self.parser.skipFast(); e != 0 { + return e + } + return self.visitor.OnObjectEnd() + } + return err + } + /* check for EOF */ self.parser.p = self.parser.lspace(sp) if self.parser.p >= ns { @@ -232,16 +252,9 @@ func (self *traverser) decodeObject() error { /* check for empty object */ if self.parser.s[self.parser.p] == '}' { self.parser.p++ - if err := self.visitor.OnObjectBegin(0); err != nil { - return err - } return self.visitor.OnObjectEnd() } - /* allocate object space and decode each pair */ - if err := self.visitor.OnObjectBegin(_DEFAULT_NODE_CAP); err != nil { - return err - } for { var njs types.JsonState var err types.ParsingError @@ -313,3 +326,7 @@ func (self *traverser) decodeString(iv int64, ep int) error { } return self.visitor.OnString(out) } + +// If visitor return this error on `OnObjectBegin()` or `OnArrayBegin()`, +// the transverer will skip entiry object or array +var VisitOPSkip = errors.New("") diff --git a/vendor/github.com/bytedance/sonic/compat.go b/vendor/github.com/bytedance/sonic/compat.go index 728bc1767..b32342a84 100644 --- a/vendor/github.com/bytedance/sonic/compat.go +++ b/vendor/github.com/bytedance/sonic/compat.go @@ -1,4 +1,4 @@ -// +build !amd64 !go1.16 go1.23 +// +build !amd64,!arm64 go1.24 !go1.17 arm64,!go1.20 /* * Copyright 2021 ByteDance Inc. @@ -27,6 +27,8 @@ import ( `github.com/bytedance/sonic/option` ) +const apiKind = UseStdJSON + type frozenConfig struct { Config } diff --git a/vendor/github.com/bytedance/sonic/decoder/decoder_amd64.go b/vendor/github.com/bytedance/sonic/decoder/decoder_amd64.go deleted file mode 100644 index 346ebbce5..000000000 --- a/vendor/github.com/bytedance/sonic/decoder/decoder_amd64.go +++ /dev/null @@ -1,68 +0,0 @@ -// +build amd64,go1.16,!go1.23 - -/* -* Copyright 2023 ByteDance Inc. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package decoder - -import ( - `github.com/bytedance/sonic/internal/decoder` -) - -// Decoder is the decoder context object -type Decoder = decoder.Decoder - -// SyntaxError represents json syntax error -type SyntaxError = decoder.SyntaxError - -// MismatchTypeError represents dismatching between json and object -type MismatchTypeError = decoder.MismatchTypeError - -// Options for decode. -type Options = decoder.Options - -const ( - OptionUseInt64 Options = decoder.OptionUseInt64 - OptionUseNumber Options = decoder.OptionUseNumber - OptionUseUnicodeErrors Options = decoder.OptionUseUnicodeErrors - OptionDisableUnknown Options = decoder.OptionDisableUnknown - OptionCopyString Options = decoder.OptionCopyString - OptionValidateString Options = decoder.OptionValidateString -) - -// StreamDecoder is the decoder context object for streaming input. -type StreamDecoder = decoder.StreamDecoder - -var ( - // NewDecoder creates a new decoder instance. - NewDecoder = decoder.NewDecoder - - // NewStreamDecoder adapts to encoding/json.NewDecoder API. - // - // NewStreamDecoder returns a new decoder that reads from r. - NewStreamDecoder = decoder.NewStreamDecoder - - // Pretouch compiles vt ahead-of-time to avoid JIT compilation on-the-fly, in - // order to reduce the first-hit latency. - // - // Opts are the compile options, for example, "option.WithCompileRecursiveDepth" is - // a compile option to set the depth of recursive compile for the nested struct type. - Pretouch = decoder.Pretouch - - // Skip skips only one json value, and returns first non-blank character position and its ending position if it is valid. - // Otherwise, returns negative error code using start and invalid character position using end - Skip = decoder.Skip -) diff --git a/vendor/github.com/bytedance/sonic/decoder/decoder_compat.go b/vendor/github.com/bytedance/sonic/decoder/decoder_compat.go index 7883862c3..81e1ae4e3 100644 --- a/vendor/github.com/bytedance/sonic/decoder/decoder_compat.go +++ b/vendor/github.com/bytedance/sonic/decoder/decoder_compat.go @@ -1,4 +1,4 @@ -// +build !amd64 !go1.16 go1.23 +// +build !amd64,!arm64 go1.24 !go1.17 arm64,!go1.20 /* * Copyright 2023 ByteDance Inc. @@ -30,7 +30,7 @@ import ( ) func init() { - println("WARNING: sonic only supports Go1.16~1.22 && CPU amd64, but your environment is not suitable") + println("WARNING: sonic/decoder only supports (Go1.17~1.23 && CPU amd64) or (go1.20~1.23 && CPU arm64), but your environment is not suitable") } const ( @@ -42,6 +42,7 @@ const ( _F_use_number = types.B_USE_NUMBER _F_validate_string = types.B_VALIDATE_STRING _F_allow_control = types.B_ALLOW_CONTROL + _F_no_validate_json = types.B_NO_VALIDATE_JSON ) type Options uint64 @@ -53,6 +54,7 @@ const ( OptionDisableUnknown Options = 1 << _F_disable_unknown OptionCopyString Options = 1 << _F_copy_string OptionValidateString Options = 1 << _F_validate_string + OptionNoValidateJSON Options = 1 << _F_no_validate_json ) func (self *Decoder) SetOptions(opts Options) { diff --git a/vendor/github.com/bytedance/sonic/decoder/decoder_native.go b/vendor/github.com/bytedance/sonic/decoder/decoder_native.go new file mode 100644 index 000000000..9317d57f6 --- /dev/null +++ b/vendor/github.com/bytedance/sonic/decoder/decoder_native.go @@ -0,0 +1,71 @@ +//go:build (amd64 && go1.17 && !go1.24) || (arm64 && go1.20 && !go1.24) +// +build amd64,go1.17,!go1.24 arm64,go1.20,!go1.24 + + +/* +* Copyright 2023 ByteDance Inc. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +package decoder + +import ( + `github.com/bytedance/sonic/internal/decoder/api` +) + +// Decoder is the decoder context object +type Decoder = api.Decoder + +// SyntaxError represents json syntax error +type SyntaxError = api.SyntaxError + +// MismatchTypeError represents dismatching between json and object +type MismatchTypeError = api.MismatchTypeError + +// Options for decode. +type Options = api.Options + +const ( + OptionUseInt64 Options = api.OptionUseInt64 + OptionUseNumber Options = api.OptionUseNumber + OptionUseUnicodeErrors Options = api.OptionUseUnicodeErrors + OptionDisableUnknown Options = api.OptionDisableUnknown + OptionCopyString Options = api.OptionCopyString + OptionValidateString Options = api.OptionValidateString + OptionNoValidateJSON Options = api.OptionNoValidateJSON +) + +// StreamDecoder is the decoder context object for streaming input. +type StreamDecoder = api.StreamDecoder + +var ( + // NewDecoder creates a new decoder instance. + NewDecoder = api.NewDecoder + + // NewStreamDecoder adapts to encoding/json.NewDecoder API. + // + // NewStreamDecoder returns a new decoder that reads from r. + NewStreamDecoder = api.NewStreamDecoder + + // Pretouch compiles vt ahead-of-time to avoid JIT compilation on-the-fly, in + // order to reduce the first-hit latency. + // + // Opts are the compile options, for example, "option.WithCompileRecursiveDepth" is + // a compile option to set the depth of recursive compile for the nested struct type. + Pretouch = api.Pretouch + + // Skip skips only one json value, and returns first non-blank character position and its ending position if it is valid. + // Otherwise, returns negative error code using start and invalid character position using end + Skip = api.Skip +) diff --git a/vendor/github.com/bytedance/sonic/encoder/encoder_amd64.go b/vendor/github.com/bytedance/sonic/encoder/encoder_amd64.go deleted file mode 100644 index 4dabec6c5..000000000 --- a/vendor/github.com/bytedance/sonic/encoder/encoder_amd64.go +++ /dev/null @@ -1,117 +0,0 @@ -// +build amd64,go1.16,!go1.23 - -/* - * Copyright 2023 ByteDance Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package encoder - -import ( - `github.com/bytedance/sonic/internal/encoder` -) - -// EnableFallback indicates if encoder use fallback -const EnableFallback = false - -// Encoder represents a specific set of encoder configurations. -type Encoder = encoder.Encoder - -// StreamEncoder uses io.Writer as input. -type StreamEncoder = encoder.StreamEncoder - -// Options is a set of encoding options. -type Options = encoder.Options - -const ( - // SortMapKeys indicates that the keys of a map needs to be sorted - // before serializing into JSON. - // WARNING: This hurts performance A LOT, USE WITH CARE. - SortMapKeys Options = encoder.SortMapKeys - - // EscapeHTML indicates encoder to escape all HTML characters - // after serializing into JSON (see https://pkg.go.dev/encoding/json#HTMLEscape). - // WARNING: This hurts performance A LOT, USE WITH CARE. - EscapeHTML Options = encoder.EscapeHTML - - // CompactMarshaler indicates that the output JSON from json.Marshaler - // is always compact and needs no validation - CompactMarshaler Options = encoder.CompactMarshaler - - // NoQuoteTextMarshaler indicates that the output text from encoding.TextMarshaler - // is always escaped string and needs no quoting - NoQuoteTextMarshaler Options = encoder.NoQuoteTextMarshaler - - // NoNullSliceOrMap indicates all empty Array or Object are encoded as '[]' or '{}', - // instead of 'null' - NoNullSliceOrMap Options = encoder.NoNullSliceOrMap - - // ValidateString indicates that encoder should validate the input string - // before encoding it into JSON. - ValidateString Options = encoder.ValidateString - - // NoValidateJSONMarshaler indicates that the encoder should not validate the output string - // after encoding the JSONMarshaler to JSON. - NoValidateJSONMarshaler Options = encoder.NoValidateJSONMarshaler - - // NoEncoderNewline indicates that the encoder should not add a newline after every message - NoEncoderNewline Options = encoder.NoEncoderNewline - - // CompatibleWithStd is used to be compatible with std encoder. - CompatibleWithStd Options = encoder.CompatibleWithStd -) - - -var ( - // Encode returns the JSON encoding of val, encoded with opts. - Encode = encoder.Encode - - // EncodeInto is like Encode but uses a user-supplied buffer instead of allocating a new one. - EncodeIndented = encoder.EncodeIndented - - // EncodeIndented is like Encode but applies Indent to format the output. - // Each JSON element in the output will begin on a new line beginning with prefix - // followed by one or more copies of indent according to the indentation nesting. - EncodeInto = encoder.EncodeInto - - // HTMLEscape appends to dst the JSON-encoded src with <, >, &, U+2028 and U+2029 - // characters inside string literals changed to \u003c, \u003e, \u0026, \u2028, \u2029 - // so that the JSON will be safe to embed inside HTML