├── .codespellrc ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── .ignore_words │ ├── benchmark.yml │ ├── compatibility_test-windows.yml │ ├── compatibility_test.yml │ ├── fuzzing.yml │ ├── lint.yml │ ├── test-arm64.yml │ └── test-x86.yml ├── .gitignore ├── .gitmodules ├── .licenserc.yaml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── CREDITS ├── LICENSE ├── README.md ├── README_ZH_CN.md ├── api.go ├── api_test.go ├── ast ├── api.go ├── api_compat.go ├── api_native_test.go ├── asm.s ├── buffer.go ├── buffer_test.go ├── decode.go ├── decode_test.go ├── encode.go ├── encode_test.go ├── error.go ├── iterator.go ├── iterator_test.go ├── node.go ├── node_test.go ├── parser.go ├── parser_test.go ├── search.go ├── search_test.go ├── stubs.go ├── testdata_test.go ├── visitor.go └── visitor_test.go ├── compat.go ├── compat_test.go ├── decode_test.go ├── decoder ├── decoder_compat.go ├── decoder_native.go ├── decoder_native_test.go ├── decoder_test.go └── testdata_test.go ├── docs ├── INTRODUCTION.md ├── INTRODUCTION_ZH_CN.md └── imgs │ ├── bench-large.png │ ├── bench-small.png │ ├── introduction-1.png │ ├── introduction-2.png │ └── other-langs.png ├── encode_test.go ├── encoder ├── encoder_compat.go ├── encoder_native.go ├── encoder_native_test.go ├── encoder_test.go └── testdata_test.go ├── examples └── example_stream_test.go ├── external_jsonlib_test ├── benchmark_test │ ├── decoder_stream_test.go │ ├── decoder_test.go │ ├── encoder_stream_test.go │ ├── encoder_test.go │ ├── parser_test.go │ ├── search_test.go │ └── testdata_test.go ├── go.mod ├── go.sum └── unit_test │ ├── api_test.go │ ├── ast_compat_test.go │ └── decoder_stream_test.go ├── fuzz ├── ast_fuzz_test.go ├── corpus.go ├── corpus │ ├── htmescape3.json │ ├── htmlescap2.json │ ├── htmlescape.json │ ├── stringnumber.json │ ├── stringnumber2.json │ ├── struct.json │ ├── twitter.json │ └── twitterescaped.json ├── fuzz_test.go ├── go.mod ├── go.sum ├── other_fuzz_test.go └── struct_fuzz_test.go ├── generic_test ├── benchmark_test.go ├── go.mod ├── go.sum ├── sonic_test.go └── testdata_test.go ├── go.mod ├── go.sum ├── go.work ├── go.work.sum ├── internal ├── caching │ ├── asm.s │ ├── fcache.go │ ├── hashing.go │ ├── hashing_test.go │ ├── pcache.go │ └── pcache_test.go ├── compat │ └── warn.go ├── cpu │ └── features.go ├── decoder │ ├── api │ │ ├── decoder.go │ │ ├── decoder_amd64.go │ │ ├── decoder_arm64.go │ │ ├── norace_test.go │ │ ├── stream.go │ │ ├── stream_test.go │ │ └── testdata_test.go │ ├── consts │ │ └── option.go │ ├── errors │ │ ├── errors.go │ │ ├── errors_test.go │ │ └── fuzz_test.go │ ├── jitdec │ │ ├── asm.s │ │ ├── asm_stubs_amd64_go117.go │ │ ├── asm_stubs_amd64_go121.go │ │ ├── assembler_regabi_amd64.go │ │ ├── assembler_test.go │ │ ├── compiler.go │ │ ├── compiler_test.go │ │ ├── debug.go │ │ ├── decoder.go │ │ ├── generic_regabi_amd64.go │ │ ├── generic_regabi_amd64_test.s │ │ ├── generic_test.go │ │ ├── pools.go │ │ ├── primitives.go │ │ ├── testdata_test.go │ │ ├── types.go │ │ └── utils.go │ └── optdec │ │ ├── compile_struct.go │ │ ├── compiler.go │ │ ├── const.go │ │ ├── context.go │ │ ├── decoder.go │ │ ├── errors.go │ │ ├── functor.go │ │ ├── helper.go │ │ ├── interface.go │ │ ├── map.go │ │ ├── native.go │ │ ├── native_test.go │ │ ├── node.go │ │ ├── slice.go │ │ ├── stringopts.go │ │ ├── structs.go │ │ ├── testdata_test.go │ │ └── types.go ├── encoder │ ├── alg │ │ ├── mapiter.go │ │ ├── opts.go │ │ ├── primitives.go │ │ ├── sort.go │ │ ├── sort_test.go │ │ ├── spec.go │ │ ├── spec_compat.go │ │ └── spec_test.go │ ├── compiler.go │ ├── compiler_test.go │ ├── encode_norace.go │ ├── encode_race.go │ ├── encoder.go │ ├── encoder_norace_test.go │ ├── encoder_test.go │ ├── ir │ │ └── op.go │ ├── omitzero_test.go │ ├── pools_amd64.go │ ├── pools_compt.go │ ├── stream.go │ ├── stream_test.go │ ├── testdata_test.go │ ├── vars │ │ ├── cache.go │ │ ├── const.go │ │ ├── errors.go │ │ ├── stack.go │ │ └── types.go │ ├── vm │ │ ├── stbus.go │ │ ├── vm.go │ │ └── vm_test.go │ └── x86 │ │ ├── asm_stubs_amd64_go117.go │ │ ├── asm_stubs_amd64_go121.go │ │ ├── assembler_regabi_amd64.go │ │ ├── assembler_test.go │ │ ├── debug_go116.go │ │ ├── debug_go117.go │ │ └── stbus.go ├── envs │ └── decode.go ├── jit │ ├── arch_amd64.go │ ├── asm.s │ ├── assembler_amd64.go │ ├── backend.go │ ├── backend_test.go │ └── runtime.go ├── native │ ├── avx2 │ │ ├── f32toa.go │ │ ├── f32toa_subr.go │ │ ├── f32toa_text_amd64.go │ │ ├── f64toa.go │ │ ├── f64toa_subr.go │ │ ├── f64toa_text_amd64.go │ │ ├── fastfloat_test.go │ │ ├── fastint_test.go │ │ ├── get_by_path.go │ │ ├── get_by_path_subr.go │ │ ├── get_by_path_text_amd64.go │ │ ├── html_escape.go │ │ ├── html_escape_subr.go │ │ ├── html_escape_text_amd64.go │ │ ├── i64toa.go │ │ ├── i64toa_subr.go │ │ ├── i64toa_text_amd64.go │ │ ├── lookup_small_key.go │ │ ├── lookup_small_key_subr.go │ │ ├── lookup_small_key_text_amd64.go │ │ ├── lspace.go │ │ ├── lspace_subr.go │ │ ├── lspace_text_amd64.go │ │ ├── native_export.go │ │ ├── native_test.go │ │ ├── parse_with_padding.go │ │ ├── parse_with_padding_subr.go │ │ ├── parse_with_padding_text_amd64.go │ │ ├── quote.go │ │ ├── quote_subr.go │ │ ├── quote_text_amd64.go │ │ ├── recover_test.go │ │ ├── skip_array.go │ │ ├── skip_array_subr.go │ │ ├── skip_array_text_amd64.go │ │ ├── skip_number.go │ │ ├── skip_number_subr.go │ │ ├── skip_number_text_amd64.go │ │ ├── skip_object.go │ │ ├── skip_object_subr.go │ │ ├── skip_object_text_amd64.go │ │ ├── skip_one.go │ │ ├── skip_one_fast.go │ │ ├── skip_one_fast_subr.go │ │ ├── skip_one_fast_text_amd64.go │ │ ├── skip_one_subr.go │ │ ├── skip_one_text_amd64.go │ │ ├── u64toa.go │ │ ├── u64toa_subr.go │ │ ├── u64toa_text_amd64.go │ │ ├── unquote.go │ │ ├── unquote_subr.go │ │ ├── unquote_text_amd64.go │ │ ├── validate_one.go │ │ ├── validate_one_subr.go │ │ ├── validate_one_text_amd64.go │ │ ├── validate_utf8.go │ │ ├── validate_utf8_fast.go │ │ ├── validate_utf8_fast_subr.go │ │ ├── validate_utf8_fast_text_amd64.go │ │ ├── validate_utf8_subr.go │ │ ├── validate_utf8_text_amd64.go │ │ ├── value.go │ │ ├── value_subr.go │ │ ├── value_text_amd64.go │ │ ├── vnumber.go │ │ ├── vnumber_subr.go │ │ ├── vnumber_text_amd64.go │ │ ├── vsigned.go │ │ ├── vsigned_subr.go │ │ ├── vsigned_text_amd64.go │ │ ├── vstring.go │ │ ├── vstring_subr.go │ │ ├── vstring_text_amd64.go │ │ ├── vunsigned.go │ │ ├── vunsigned_subr.go │ │ └── vunsigned_text_amd64.go │ ├── dispatch_amd64.go │ ├── dispatch_arm64.go │ ├── f32toa.tmpl │ ├── f64toa.tmpl │ ├── fastfloat_test.tmpl │ ├── fastint_test.tmpl │ ├── get_by_path.tmpl │ ├── html_escape.tmpl │ ├── i64toa.tmpl │ ├── lookup_small_key.tmpl │ ├── lspace.tmpl │ ├── native_export.tmpl │ ├── native_test.tmpl │ ├── neon │ │ ├── f32toa_arm64.go │ │ ├── f32toa_arm64.s │ │ ├── f32toa_subr_arm64.go │ │ ├── f64toa_arm64.go │ │ ├── f64toa_arm64.s │ │ ├── f64toa_subr_arm64.go │ │ ├── fastfloat_arm64_test.go │ │ ├── fastint_arm64_test.go │ │ ├── get_by_path_arm64.go │ │ ├── get_by_path_arm64.s │ │ ├── get_by_path_subr_arm64.go │ │ ├── html_escape_arm64.go │ │ ├── html_escape_arm64.s │ │ ├── html_escape_subr_arm64.go │ │ ├── i64toa_arm64.go │ │ ├── i64toa_arm64.s │ │ ├── i64toa_subr_arm64.go │ │ ├── lookup_small_key_arm64.go │ │ ├── lookup_small_key_arm64.s │ │ ├── lookup_small_key_subr_arm64.go │ │ ├── lspace_arm64.go │ │ ├── lspace_arm64.s │ │ ├── lspace_subr_arm64.go │ │ ├── native_arm64_test.go │ │ ├── native_export_arm64.go │ │ ├── parse_with_padding_arm64.go │ │ ├── parse_with_padding_arm64.s │ │ ├── parse_with_padding_subr_arm64.go │ │ ├── quote_arm64.go │ │ ├── quote_arm64.s │ │ ├── quote_subr_arm64.go │ │ ├── recover_arm64_test.go │ │ ├── skip_array_arm64.go │ │ ├── skip_array_arm64.s │ │ ├── skip_array_subr_arm64.go │ │ ├── skip_number_arm64.go │ │ ├── skip_number_arm64.s │ │ ├── skip_number_subr_arm64.go │ │ ├── skip_object_arm64.go │ │ ├── skip_object_arm64.s │ │ ├── skip_object_subr_arm64.go │ │ ├── skip_one_arm64.go │ │ ├── skip_one_arm64.s │ │ ├── skip_one_fast_arm64.go │ │ ├── skip_one_fast_arm64.s │ │ ├── skip_one_fast_subr_arm64.go │ │ ├── skip_one_subr_arm64.go │ │ ├── u64toa_arm64.go │ │ ├── u64toa_arm64.s │ │ ├── u64toa_subr_arm64.go │ │ ├── unquote_arm64.go │ │ ├── unquote_arm64.s │ │ ├── unquote_subr_arm64.go │ │ ├── validate_one_arm64.go │ │ ├── validate_one_arm64.s │ │ ├── validate_one_subr_arm64.go │ │ ├── validate_utf8_arm64.go │ │ ├── validate_utf8_arm64.s │ │ ├── validate_utf8_fast_arm64.go │ │ ├── validate_utf8_fast_arm64.s │ │ ├── validate_utf8_fast_subr_arm64.go │ │ ├── validate_utf8_subr_arm64.go │ │ ├── value_arm64.go │ │ ├── value_arm64.s │ │ ├── value_subr_arm64.go │ │ ├── vnumber_arm64.go │ │ ├── vnumber_arm64.s │ │ ├── vnumber_subr_arm64.go │ │ ├── vsigned_arm64.go │ │ ├── vsigned_arm64.s │ │ ├── vsigned_subr_arm64.go │ │ ├── vstring_arm64.go │ │ ├── vstring_arm64.s │ │ ├── vstring_subr_arm64.go │ │ ├── vunsigned_arm64.go │ │ ├── vunsigned_arm64.s │ │ └── vunsigned_subr_arm64.go │ ├── parse_with_padding.tmpl │ ├── quote.tmpl │ ├── recover_test.tmpl │ ├── skip_array.tmpl │ ├── skip_number.tmpl │ ├── skip_object.tmpl │ ├── skip_one.tmpl │ ├── skip_one_fast.tmpl │ ├── sse │ │ ├── f32toa.go │ │ ├── f32toa_subr.go │ │ ├── f32toa_text_amd64.go │ │ ├── f64toa.go │ │ ├── f64toa_subr.go │ │ ├── f64toa_text_amd64.go │ │ ├── fastfloat_test.go │ │ ├── fastint_test.go │ │ ├── get_by_path.go │ │ ├── get_by_path_subr.go │ │ ├── get_by_path_text_amd64.go │ │ ├── html_escape.go │ │ ├── html_escape_subr.go │ │ ├── html_escape_text_amd64.go │ │ ├── i64toa.go │ │ ├── i64toa_subr.go │ │ ├── i64toa_text_amd64.go │ │ ├── lookup_small_key.go │ │ ├── lookup_small_key_subr.go │ │ ├── lookup_small_key_text_amd64.go │ │ ├── lspace.go │ │ ├── lspace_subr.go │ │ ├── lspace_text_amd64.go │ │ ├── native_export.go │ │ ├── native_test.go │ │ ├── parse_with_padding.go │ │ ├── parse_with_padding_subr.go │ │ ├── parse_with_padding_text_amd64.go │ │ ├── quote.go │ │ ├── quote_subr.go │ │ ├── quote_text_amd64.go │ │ ├── recover_test.go │ │ ├── skip_array.go │ │ ├── skip_array_subr.go │ │ ├── skip_array_text_amd64.go │ │ ├── skip_number.go │ │ ├── skip_number_subr.go │ │ ├── skip_number_text_amd64.go │ │ ├── skip_object.go │ │ ├── skip_object_subr.go │ │ ├── skip_object_text_amd64.go │ │ ├── skip_one.go │ │ ├── skip_one_fast.go │ │ ├── skip_one_fast_subr.go │ │ ├── skip_one_fast_text_amd64.go │ │ ├── skip_one_subr.go │ │ ├── skip_one_text_amd64.go │ │ ├── u64toa.go │ │ ├── u64toa_subr.go │ │ ├── u64toa_text_amd64.go │ │ ├── unquote.go │ │ ├── unquote_subr.go │ │ ├── unquote_text_amd64.go │ │ ├── validate_one.go │ │ ├── validate_one_subr.go │ │ ├── validate_one_text_amd64.go │ │ ├── validate_utf8.go │ │ ├── validate_utf8_fast.go │ │ ├── validate_utf8_fast_subr.go │ │ ├── validate_utf8_fast_text_amd64.go │ │ ├── validate_utf8_subr.go │ │ ├── validate_utf8_text_amd64.go │ │ ├── value.go │ │ ├── value_subr.go │ │ ├── value_text_amd64.go │ │ ├── vnumber.go │ │ ├── vnumber_subr.go │ │ ├── vnumber_text_amd64.go │ │ ├── vsigned.go │ │ ├── vsigned_subr.go │ │ ├── vsigned_text_amd64.go │ │ ├── vstring.go │ │ ├── vstring_subr.go │ │ ├── vstring_text_amd64.go │ │ ├── vunsigned.go │ │ ├── vunsigned_subr.go │ │ └── vunsigned_text_amd64.go │ ├── traceback_test.mock_tmpl │ ├── types │ │ └── types.go │ ├── u64toa.tmpl │ ├── unquote.tmpl │ ├── validate_one.tmpl │ ├── validate_utf8.tmpl │ ├── validate_utf8_fast.tmpl │ ├── value.tmpl │ ├── vnumber.tmpl │ ├── vsigned.tmpl │ ├── vstring.tmpl │ └── vunsigned.tmpl ├── optcaching │ ├── asm.s │ └── fcache.go ├── resolver │ ├── asm.s │ ├── resolver.go │ ├── resolver_test.go │ ├── stubs_go120.go │ ├── stubs_go123.go │ └── stubs_latest.go ├── rt │ ├── asm_amd64.s │ ├── asm_compat.s │ ├── assertI2I.go │ ├── base64_amd64.go │ ├── base64_compat.go │ ├── fastconv.go │ ├── fastconv_test.go │ ├── fastmem.go │ ├── fastvalue.go │ ├── gcwb.go │ ├── gcwb_legacy.go │ ├── growslice.go │ ├── growslice_legacy.go │ ├── int48.go │ ├── map_legacy.go │ ├── map_nosiwss_go124.go │ ├── map_siwss_go124.go │ ├── pool.go │ ├── pool_test.go │ ├── stubs.go │ ├── stubs_test.go │ ├── table.go │ └── types.go └── utils │ └── skip.go ├── issue_test ├── biz_test.go ├── common_test.go ├── hugestruct_test.go ├── issue100_test.go ├── issue101_test.go ├── issue107_test.go ├── issue108_test.go ├── issue112_test.go ├── issue113_test.go ├── issue115_test.go ├── issue119_test.go ├── issue123_test.go ├── issue128_test.go ├── issue138_test.go ├── issue141_test.go ├── issue144_test.go ├── issue16_test.go ├── issue182_test.go ├── issue186_test.go ├── issue195_test.go ├── issue206_test.go ├── issue213_test.go ├── issue242_test.go ├── issue248_test.go ├── issue258_test.go ├── issue263_test.go ├── issue273_test.go ├── issue27_test.go ├── issue293_test.go ├── issue379_test.go ├── issue381_test.go ├── issue390_test.go ├── issue39_test.go ├── issue3_test.go ├── issue403_test.go ├── issue406_test.go ├── issue437_test.go ├── issue45_test.go ├── issue460_test.go ├── issue465_test.go ├── issue491_test.go ├── issue507_test.go ├── issue539_test.go ├── issue58_test.go ├── issue5_test.go ├── issue600_test.go ├── issue634_test.go ├── issue670_test.go ├── issue67_test.go ├── issue692_test.go ├── issue716_test.go ├── issue739_test.go ├── issue744_test.go ├── issue747_test.go ├── issue750_test.go ├── issue755_test.go ├── issue758_test.go ├── issue762_test.go ├── issue76_test.go ├── issue772_test.go ├── issue774_test.go ├── issue777_test.go ├── issue7_test.go ├── issue82_test.go ├── issue83_test.go ├── issue8_test.go ├── issue90_test.go ├── issue93_test.go ├── issue98_test.go ├── issue_recurse_test.go ├── plugin │ └── main.go ├── plugin_test.go ├── pretouch_test.go ├── race_test_go └── testmain_test.go ├── licenses ├── LICENSE-Drachennest ├── LICENSE-eisel_lemire ├── LICENSE-golang ├── LICENSE-golang-asm ├── LICENSE-simdjson └── LICENSE-yyjson ├── loader ├── funcdata.go ├── funcdata_compat.go ├── funcdata_go117.go ├── funcdata_go118.go ├── funcdata_go120.go ├── funcdata_go121.go ├── funcdata_go123.go ├── funcdata_latest.go ├── go.mod ├── go.sum ├── internal │ ├── abi │ │ ├── abi.go │ │ ├── abi_amd64.go │ │ ├── abi_legacy_amd64.go │ │ ├── abi_regabi_amd64.go │ │ └── stubs.go │ ├── iasm │ │ ├── expr │ │ │ ├── ast.go │ │ │ ├── errors.go │ │ │ ├── ops.go │ │ │ ├── parser.go │ │ │ ├── parser_test.go │ │ │ ├── pools.go │ │ │ ├── term.go │ │ │ └── utils.go │ │ ├── obj │ │ │ ├── macho.go │ │ │ ├── macho_test.go │ │ │ └── obj.go │ │ ├── sync.sh │ │ ├── trim.py │ │ └── x86_64 │ │ │ ├── arch.go │ │ │ ├── asm.s │ │ │ ├── eface.go │ │ │ ├── encodings.go │ │ │ ├── instructions.go │ │ │ ├── instructions_table.go │ │ │ ├── instructions_test.go │ │ │ ├── operands.go │ │ │ ├── pools.go │ │ │ ├── program.go │ │ │ ├── program_test.go │ │ │ ├── registers.go │ │ │ └── utils.go │ └── rt │ │ ├── fastmem.go │ │ ├── fastvalue.go │ │ └── stackmap.go ├── loader.go ├── loader_go117_test.go ├── loader_latest.go ├── mmap_unix.go ├── mmap_windows.go ├── pcdata.go ├── register.go ├── register_tango.go ├── register_test.go ├── stubs.go ├── wrapper.go └── wrapper_test.go ├── native ├── atof_eisel_lemire.h ├── atof_native.h ├── f32toa.c ├── f64toa.c ├── fastint.h ├── get_by_path.c ├── html_escape.c ├── i64toa.c ├── lookup_small_key.c ├── lspace.c ├── lspace.h ├── native.h ├── parse_with_padding.c ├── parsing.h ├── quote.c ├── scanning.h ├── simd.h ├── skip_array.c ├── skip_number.c ├── skip_object.c ├── skip_one.c ├── skip_one_fast.c ├── tab.h ├── test │ ├── xassert.h │ └── xprintf.h ├── types.h ├── u64toa.c ├── unittest │ ├── test_fastfint.c │ └── test_to_lower.c ├── unquote.c ├── utf8.h ├── utils.h ├── validate_one.c ├── validate_utf8.c ├── validate_utf8_fast.c ├── value.c ├── vnumber.c ├── vsigned.c ├── vstring.c ├── vstring.h └── vunsigned.c ├── option └── option.go ├── rawmessage.go ├── rfc_test.go ├── scripts ├── bench-arm.sh ├── bench.py ├── bench.sh ├── build-arm.sh ├── build-x86.sh ├── check_branch_name.sh ├── fuzz.sh ├── go_flags.sh ├── qemu.sh ├── test_pcsp.py └── test_race.sh ├── search_test.go ├── sonic.go ├── testdata ├── canada_geometry.json.gz ├── citm_catalog.json.gz ├── golang_source.json.gz ├── small.go ├── string_escaped.json.gz ├── string_unicode.json.gz ├── synthea_fhir.json.gz ├── twitter.go ├── twitter.json ├── twitter_status.json.gz └── twitterescaped.json ├── tools └── asm2arm │ ├── arm.py │ └── requirements.txt ├── unquote └── unquote.go └── utf8 ├── utf8.go └── utf8_test.go /.codespellrc: -------------------------------------------------------------------------------- 1 | [codespell] 2 | # ignore test files, go project names, binary files via `skip` and special var/regex via `ignore-words` 3 | skip = fuzz,*_test.tmpl,testdata,*_test.go,go.mod,go.sum,*.gz 4 | ignore-words = .github/workflows/.ignore_words 5 | check-filenames = true 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | 12 | A clear and concise description of what the bug is. 13 | 14 | **To Reproduce** 15 | 16 | Steps to reproduce the behavior: 17 | 1. Go to '...' 18 | 2. Click on '....' 19 | 3. Scroll down to '....' 20 | 4. See error 21 | 22 | **Expected behavior** 23 | 24 | A clear and concise description of what you expected to happen. 25 | 26 | **Screenshots** 27 | 28 | If applicable, add screenshots to help explain your problem. 29 | 30 | **Sonic version:** 31 | 32 | Please provide the version of Sonic you are using. 33 | 34 | **Environment:** 35 | 36 | The output of `go env`. 37 | 38 | **Additional context** 39 | 40 | Add any other context about the problem here. 41 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | 12 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 13 | 14 | **Describe the solution you'd like** 15 | 16 | A clear and concise description of what you want to happen. 17 | 18 | **Describe alternatives you've considered** 19 | 20 | A clear and concise description of any alternative solutions or features you've considered. 21 | 22 | **Additional context** 23 | 24 | Add any other context or screenshots about the feature request here. 25 | -------------------------------------------------------------------------------- /.github/workflows/.ignore_words: -------------------------------------------------------------------------------- 1 | socio-economic 2 | nd 3 | regArgs 4 | oders 5 | ure 6 | alse 7 | -------------------------------------------------------------------------------- /.github/workflows/compatibility_test-windows.yml: -------------------------------------------------------------------------------- 1 | name: Compatibility Test Windows-X64 2 | 3 | on: pull_request 4 | 5 | jobs: 6 | build: 7 | strategy: 8 | matrix: 9 | go-version: [1.17.x, 1.22.x, 1.23.x] 10 | runs-on: windows-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | 14 | - name: Set up Go 15 | uses: actions/setup-go@v2 16 | with: 17 | go-version: ${{ matrix.go-version }} 18 | 19 | - uses: actions/cache@v4 20 | with: 21 | path: ~/go/pkg/mod 22 | key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 23 | restore-keys: | 24 | ${{ runner.os }}-go- 25 | 26 | - name: main 27 | run: | 28 | set GOMAXPROCS=4 29 | go test -v -race ./ 30 | 31 | - name: ast 32 | run: | 33 | set GOMAXPROCS=4 34 | go test -v -race ./ast 35 | 36 | - name: external 37 | run: | 38 | cd ./external_jsonlib_test 39 | set GOMAXPROCS=4 40 | go test -v -race ./... 41 | -------------------------------------------------------------------------------- /.github/workflows/fuzzing.yml: -------------------------------------------------------------------------------- 1 | name: Fuzz Test Linux-X64 2 | 3 | on: pull_request 4 | 5 | jobs: 6 | build: 7 | strategy: 8 | max-parallel: 2 9 | matrix: 10 | mode: [run, runopt] 11 | os: [ubuntu-latest, ubuntu-24.04-arm] 12 | exclude: 13 | - os: ubuntu-24.04-arm 14 | mode: runopt 15 | 16 | runs-on: ${{ matrix.os }} 17 | steps: 18 | - name: Clear repository 19 | run: sudo rm -fr $GITHUB_WORKSPACE && mkdir $GITHUB_WORKSPACE 20 | 21 | - uses: actions/checkout@v2 22 | 23 | - name: Set up Go 24 | uses: actions/setup-go@v2 25 | with: 26 | go-version: 1.20.x 27 | 28 | - uses: actions/cache@v4 29 | with: 30 | path: ~/go/pkg/mod 31 | key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} 32 | restore-keys: | 33 | ${{ runner.os }}-go- 34 | 35 | - name: Fuzz sonic 36 | run: ./scripts/fuzz.sh ${{ matrix.mode }} 37 | 38 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | 3 | on: pull_request 4 | 5 | jobs: 6 | misc: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v4 10 | - name: spell check 11 | uses: codespell-project/actions-codespell@v2 12 | with: 13 | skip: ./loader/internal/iasm/obj/macho.go,./loader/internal/iasm/x86_64/encodings.go,./loader/internal/iasm/x86_64/program.go,./loader/internal/iasm/expr/ast.go,./loader/internal/iasm/expr/errors.go 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.swp 3 | *.swm 4 | *.swn 5 | *.a 6 | *.so 7 | _obj 8 | _test 9 | *.[568vq] 10 | [568vq].out 11 | *.cgo1.go 12 | *.cgo2.c 13 | _cgo_defun.c 14 | _cgo_gotypes.go 15 | _cgo_export.* 16 | _testmain.go 17 | *.exe 18 | *.exe~ 19 | *.test 20 | *.prof 21 | *.rar 22 | *.zip 23 | *.gz 24 | *.psd 25 | *.bmd 26 | *.cfg 27 | *.pptx 28 | *.log 29 | *nohup.out 30 | *settings.pyc 31 | *.sublime-project 32 | *.sublime-workspace 33 | .DS_Store 34 | /.idea/ 35 | /.vscode/ 36 | /output/ 37 | /vendor/ 38 | /Gopkg.lock 39 | /Gopkg.toml 40 | coverage.html 41 | coverage.out 42 | coverage.xml 43 | junit.xml 44 | *.profile 45 | *.svg 46 | *.out 47 | ast/test.out 48 | ast/bench.sh 49 | 50 | !testdata/*.json.gz 51 | fuzz/testdata 52 | *__debug_bin* 53 | *pprof 54 | *coverage.txt 55 | tools/venv/* -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "cloudwego"] 2 | path = tools/asm2asm 3 | url = https://github.com/cloudwego/asm2asm.git 4 | [submodule "tools/simde"] 5 | path = tools/simde 6 | url = https://github.com/simd-everywhere/simde.git 7 | [submodule "fuzz/go-fuzz-corpus"] 8 | path = fuzz/go-fuzz-corpus 9 | url = https://github.com/dvyukov/go-fuzz-corpus.git 10 | -------------------------------------------------------------------------------- /.licenserc.yaml: -------------------------------------------------------------------------------- 1 | header: 2 | license: 3 | spdx-id: Apache-2.0 4 | copyright-owner: ByteDance Inc. 5 | 6 | paths: 7 | - '**/*.go' 8 | - '**/*.s' 9 | 10 | paths-ignore: 11 | - 'ast/asm.s' # empty file 12 | - 'decoder/asm.s' # empty file 13 | - 'encoder/asm.s' # empty file 14 | - 'internal/caching/asm.s' # empty file 15 | - 'internal/jit/asm.s' # empty file 16 | - 'internal/native/avx/native_amd64.s' # auto-generated by asm2asm 17 | - 'internal/native/avx/native_subr_amd64.go' # auto-generated by asm2asm 18 | - 'internal/native/avx2/native_amd64.s' # auto-generated by asm2asm 19 | - 'internal/native/avx2/native_subr_amd64.go' # auto-generated by asm2asm 20 | - 'internal/resolver/asm.s' # empty file 21 | - 'internal/rt/asm.s' # empty file 22 | - 'internal/loader/asm.s' # empty file 23 | 24 | comment: on-failure -------------------------------------------------------------------------------- /CREDITS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/sonic/a5ac536f86e855ee984145f7426db6bb7998d858/CREDITS -------------------------------------------------------------------------------- /ast/asm.s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/sonic/a5ac536f86e855ee984145f7426db6bb7998d858/ast/asm.s -------------------------------------------------------------------------------- /ast/stubs.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package ast 18 | 19 | import ( 20 | "unsafe" 21 | 22 | "github.com/bytedance/sonic/internal/rt" 23 | ) 24 | 25 | //go:nosplit 26 | func mem2ptr(s []byte) unsafe.Pointer { 27 | return (*rt.GoSlice)(unsafe.Pointer(&s)).Ptr 28 | } 29 | 30 | //go:linkname unquoteBytes encoding/json.unquoteBytes 31 | func unquoteBytes(s []byte) (t []byte, ok bool) 32 | -------------------------------------------------------------------------------- /docs/imgs/bench-large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/sonic/a5ac536f86e855ee984145f7426db6bb7998d858/docs/imgs/bench-large.png -------------------------------------------------------------------------------- /docs/imgs/bench-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/sonic/a5ac536f86e855ee984145f7426db6bb7998d858/docs/imgs/bench-small.png -------------------------------------------------------------------------------- /docs/imgs/introduction-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/sonic/a5ac536f86e855ee984145f7426db6bb7998d858/docs/imgs/introduction-1.png -------------------------------------------------------------------------------- /docs/imgs/introduction-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/sonic/a5ac536f86e855ee984145f7426db6bb7998d858/docs/imgs/introduction-2.png -------------------------------------------------------------------------------- /docs/imgs/other-langs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/sonic/a5ac536f86e855ee984145f7426db6bb7998d858/docs/imgs/other-langs.png -------------------------------------------------------------------------------- /examples/example_stream_test.go: -------------------------------------------------------------------------------- 1 | // +build !go1.24 2 | 3 | package example 4 | 5 | import ( 6 | "bytes" 7 | "fmt" 8 | "strings" 9 | "github.com/bytedance/sonic" 10 | ) 11 | 12 | // This example uses a Decoder to decode a stream of distinct JSON values. 13 | func ExampleStreamDecoder() { 14 | var o = map[string]interface{}{} 15 | var r = strings.NewReader(`{"a":"b"}{"1":"2"}`) 16 | var dec = sonic.ConfigDefault.NewDecoder(r) 17 | dec.Decode(&o) 18 | dec.Decode(&o) 19 | fmt.Printf("%+v", o) 20 | // Output: 21 | // map[1:2 a:b] 22 | } 23 | 24 | 25 | // This example uses a Encoder to encode streamingly. 26 | func ExampleStreamEncoder() { 27 | var o1 = map[string]interface{}{ 28 | "a": "b", 29 | } 30 | var o2 = 1 31 | var w = bytes.NewBuffer(nil) 32 | var enc = sonic.ConfigDefault.NewEncoder(w) 33 | enc.Encode(o1) 34 | enc.Encode(o2) 35 | fmt.Println(w.String()) 36 | // Output: 37 | // {"a":"b"} 38 | // 1 39 | } -------------------------------------------------------------------------------- /external_jsonlib_test/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/bytedance/sonic/external_jsonlib_test 2 | 3 | go 1.18 4 | 5 | require ( 6 | github.com/buger/jsonparser v1.1.1 7 | github.com/bytedance/sonic v1.11.5-alpha3 8 | github.com/goccy/go-json v0.9.11 9 | github.com/json-iterator/go v1.1.12 10 | github.com/stretchr/testify v1.8.1 11 | github.com/tidwall/gjson v1.14.3 12 | github.com/tidwall/sjson v1.2.5 13 | github.com/valyala/fastjson v1.6.4 14 | ) 15 | 16 | require ( 17 | github.com/bytedance/sonic/loader v0.2.4 // indirect 18 | github.com/cloudwego/base64x v0.1.5 // indirect 19 | github.com/davecgh/go-spew v1.1.1 // indirect 20 | github.com/klauspost/cpuid/v2 v2.0.9 // indirect 21 | github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect 22 | github.com/modern-go/reflect2 v1.0.2 // indirect 23 | github.com/pmezard/go-difflib v1.0.0 // indirect 24 | github.com/tidwall/match v1.1.1 // indirect 25 | github.com/tidwall/pretty v1.2.0 // indirect 26 | github.com/twitchyliquid64/golang-asm v0.15.1 // indirect 27 | golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect 28 | gopkg.in/yaml.v3 v3.0.1 // indirect 29 | ) 30 | 31 | replace github.com/bytedance/sonic => ../. 32 | -------------------------------------------------------------------------------- /fuzz/corpus/htmescape3.json: -------------------------------------------------------------------------------- 1 | "&&&&&&&&&&&&&&&&&&&&&&&\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&" -------------------------------------------------------------------------------- /fuzz/corpus/htmlescap2.json: -------------------------------------------------------------------------------- 1 | "{\"\"\u2028\x94\xe2\x00\x00\x00\x00\x00\x00\x00\x00\u2028\x80\u2028\x80\u2028\xe2\u2028\x8a\u2028⑀\xa8\x8a\xa8\xe2\u2028\xe2\u2028\xe2\u2028\xe2\u2000\x8d\xe2\u2028\xe2\u2028\xe2\xe2\xa8\"}" -------------------------------------------------------------------------------- /fuzz/corpus/htmlescape.json: -------------------------------------------------------------------------------- 1 | "&<>\u2028\u2029" -------------------------------------------------------------------------------- /fuzz/corpus/stringnumber.json: -------------------------------------------------------------------------------- 1 | "123" -------------------------------------------------------------------------------- /fuzz/corpus/stringnumber2.json: -------------------------------------------------------------------------------- 1 | "-1.23e+1" -------------------------------------------------------------------------------- /fuzz/corpus/struct.json: -------------------------------------------------------------------------------- 1 | { 2 | "A": -8111819689795174000, 3 | "B": "fQhhLProOY hello \\\" 你好 😊", 4 | "C": 3.577476171476308e+307, 5 | "D": true, 6 | "E": 101, 7 | "G": null, 8 | "H": { 9 | "xSVe": null 10 | }, 11 | "I": { 12 | "ziiOUtpFV": "RfJwBZnEwm" 13 | }, 14 | "J": [ 15 | null, 16 | true, 17 | [], 18 | {} 19 | ], 20 | "K": [ 21 | "fSiOMJVJdi", 22 | "CLpA", 23 | "\\", 24 | "123", 25 | "" 26 | ], 27 | "L": { 28 | "A": -1231349968732903200, 29 | "B": "QUqZKwhY" 30 | }, 31 | "M": { 32 | "A": 5011712756157650000, 33 | "B": "hWkae" 34 | }, 35 | "N": -8055612484288639000, 36 | "O": -412156671407452740, 37 | "P": "123", 38 | "Q": "-1.23e+1", 39 | "R": 0, 40 | "T": {}, 41 | "U": [ 42 | 7233499441428055000, 43 | 3869227355117358600 44 | ], 45 | "V": 0, 46 | "W": "0.123456e-123", 47 | "X": {"raw": "json"}, 48 | "Y": "abc", 49 | "Z": "123" 50 | } -------------------------------------------------------------------------------- /fuzz/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/bytedance/sonic/fuzz 2 | 3 | go 1.18 4 | 5 | require ( 6 | github.com/bytedance/gopkg v0.0.0-20221122125632-68358b8ecec6 7 | github.com/bytedance/sonic v1.11.5-alpha3 8 | github.com/davecgh/go-spew v1.1.1 9 | github.com/stretchr/testify v1.8.1 10 | ) 11 | 12 | require ( 13 | github.com/bytedance/sonic/loader v0.2.2 // indirect 14 | github.com/cloudwego/base64x v0.1.4 // indirect 15 | github.com/klauspost/cpuid/v2 v2.0.9 // indirect 16 | github.com/pmezard/go-difflib v1.0.0 // indirect 17 | github.com/twitchyliquid64/golang-asm v0.15.1 // indirect 18 | golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect 19 | gopkg.in/yaml.v3 v3.0.1 // indirect 20 | ) 21 | 22 | replace github.com/bytedance/sonic => ../. 23 | -------------------------------------------------------------------------------- /generic_test/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/bytedance/sonic/generic_test 2 | 3 | go 1.18 4 | 5 | require ( 6 | github.com/bytedance/sonic v1.11.5-alpha3 7 | github.com/go-json-experiment/json v0.0.0-20220603215908-554802c1e539 8 | github.com/goccy/go-json v0.9.11 9 | github.com/json-iterator/go v1.1.12 10 | ) 11 | 12 | require ( 13 | github.com/bytedance/sonic/loader v0.2.4 // indirect 14 | github.com/cloudwego/base64x v0.1.5 // indirect 15 | github.com/klauspost/cpuid/v2 v2.0.9 // indirect 16 | github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect 17 | github.com/modern-go/reflect2 v1.0.2 // indirect 18 | github.com/twitchyliquid64/golang-asm v0.15.1 // indirect 19 | golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect 20 | ) 21 | 22 | replace github.com/bytedance/sonic => ../. 23 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/bytedance/sonic 2 | 3 | go 1.17 4 | 5 | require ( 6 | github.com/bytedance/sonic/loader v0.2.4 7 | github.com/cloudwego/base64x v0.1.5 8 | github.com/davecgh/go-spew v1.1.1 9 | github.com/klauspost/cpuid/v2 v2.0.9 10 | github.com/stretchr/testify v1.8.1 11 | github.com/twitchyliquid64/golang-asm v0.15.1 12 | golang.org/x/arch v0.0.0-20210923205945-b76863e36670 13 | ) 14 | 15 | require ( 16 | github.com/pmezard/go-difflib v1.0.0 // indirect 17 | gopkg.in/yaml.v3 v3.0.1 // indirect 18 | ) 19 | -------------------------------------------------------------------------------- /go.work: -------------------------------------------------------------------------------- 1 | go 1.18 2 | 3 | use ( 4 | . 5 | ./external_jsonlib_test 6 | ./fuzz 7 | ./generic_test 8 | ./loader 9 | ) 10 | -------------------------------------------------------------------------------- /go.work.sum: -------------------------------------------------------------------------------- 1 | github.com/bytedance/sonic/loader v0.2.0/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= 2 | github.com/bytedance/sonic/loader v0.2.3/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= 3 | github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= 4 | github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= 5 | github.com/klauspost/cpuid/v2 v2.2.9 h1:66ze0taIn2H33fBvCkXuv9BmCwDfafmiIVpKV9kKGuY= 6 | github.com/klauspost/cpuid/v2 v2.2.9/go.mod h1:rqkxqrZ1EhYM9G+hXH7YdowN5R5RGN6NK4QwQ3WMXF8= 7 | golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 8 | -------------------------------------------------------------------------------- /internal/caching/asm.s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/sonic/a5ac536f86e855ee984145f7426db6bb7998d858/internal/caching/asm.s -------------------------------------------------------------------------------- /internal/caching/hashing.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package caching 18 | 19 | import ( 20 | `unsafe` 21 | 22 | `github.com/bytedance/sonic/internal/rt` 23 | ) 24 | 25 | var ( 26 | V_strhash = rt.UnpackEface(rt.Strhash) 27 | S_strhash = *(*uintptr)(V_strhash.Value) 28 | ) 29 | 30 | func StrHash(s string) uint64 { 31 | if v := rt.Strhash(unsafe.Pointer(&s), 0); v == 0 { 32 | return 1 33 | } else { 34 | return uint64(v) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /internal/compat/warn.go: -------------------------------------------------------------------------------- 1 | // +build !amd64,!arm64 go1.25 !go1.17 arm64,!go1.20 2 | 3 | package compat 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | ) 9 | 10 | func Warn(prefix string) { 11 | fmt.Fprintf(os.Stderr, "WARNING: %s only supports (go1.17~1.24 && amd64 CPU) or (go1.20~1.24 && arm64 CPU), but your environment is not suitable and will fallback to encoding/json\n", prefix) 12 | } 13 | -------------------------------------------------------------------------------- /internal/decoder/api/decoder_amd64.go: -------------------------------------------------------------------------------- 1 | //go:build go1.17 && !go1.25 2 | // +build go1.17,!go1.25 3 | 4 | /* 5 | * Copyright 2021 ByteDance Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | package api 21 | 22 | import ( 23 | "github.com/bytedance/sonic/internal/envs" 24 | "github.com/bytedance/sonic/internal/decoder/jitdec" 25 | "github.com/bytedance/sonic/internal/decoder/optdec" 26 | ) 27 | 28 | var ( 29 | pretouchImpl = jitdec.Pretouch 30 | decodeImpl = jitdec.Decode 31 | ) 32 | 33 | func init() { 34 | if envs.UseOptDec { 35 | pretouchImpl = optdec.Pretouch 36 | decodeImpl = optdec.Decode 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /internal/decoder/api/decoder_arm64.go: -------------------------------------------------------------------------------- 1 | // +build go1.17,!go1.25 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package api 20 | 21 | import ( 22 | `github.com/bytedance/sonic/internal/decoder/optdec` 23 | `github.com/bytedance/sonic/internal/envs` 24 | ) 25 | 26 | var ( 27 | pretouchImpl = optdec.Pretouch 28 | decodeImpl = optdec.Decode 29 | ) 30 | 31 | 32 | func init() { 33 | // when in aarch64, we enable all optimization 34 | envs.EnableOptDec() 35 | envs.EnableFastMap() 36 | } 37 | 38 | 39 | -------------------------------------------------------------------------------- /internal/decoder/consts/option.go: -------------------------------------------------------------------------------- 1 | 2 | package consts 3 | 4 | import ( 5 | `github.com/bytedance/sonic/internal/native/types` 6 | ) 7 | 8 | 9 | const ( 10 | F_use_int64 = 0 11 | F_disable_urc = 2 12 | F_disable_unknown = 3 13 | F_copy_string = 4 14 | 15 | F_use_number = types.B_USE_NUMBER 16 | F_validate_string = types.B_VALIDATE_STRING 17 | F_allow_control = types.B_ALLOW_CONTROL 18 | F_no_validate_json = types.B_NO_VALIDATE_JSON 19 | F_case_sensitive = 7 20 | ) 21 | 22 | type Options uint64 23 | 24 | const ( 25 | OptionUseInt64 Options = 1 << F_use_int64 26 | OptionUseNumber Options = 1 << F_use_number 27 | OptionUseUnicodeErrors Options = 1 << F_disable_urc 28 | OptionDisableUnknown Options = 1 << F_disable_unknown 29 | OptionCopyString Options = 1 << F_copy_string 30 | OptionValidateString Options = 1 << F_validate_string 31 | OptionNoValidateJSON Options = 1 << F_no_validate_json 32 | OptionCaseSensitive Options = 1 << F_case_sensitive 33 | ) 34 | 35 | const ( 36 | MaxStack = 4096 37 | ) -------------------------------------------------------------------------------- /internal/decoder/jitdec/asm.s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/sonic/a5ac536f86e855ee984145f7426db6bb7998d858/internal/decoder/jitdec/asm.s -------------------------------------------------------------------------------- /internal/decoder/jitdec/compiler_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jitdec 18 | 19 | import ( 20 | `reflect` 21 | `testing` 22 | 23 | `github.com/stretchr/testify/assert` 24 | ) 25 | 26 | func TestCompiler_Compile(t *testing.T) { 27 | prg, err := newCompiler().compile(reflect.TypeOf(TwitterStruct{})) 28 | assert.Nil(t, err) 29 | prg.disassemble() 30 | } 31 | -------------------------------------------------------------------------------- /internal/decoder/jitdec/utils.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jitdec 18 | 19 | import ( 20 | `unsafe` 21 | 22 | `github.com/bytedance/sonic/loader` 23 | ) 24 | 25 | //go:nosplit 26 | func pbool(v bool) uintptr { 27 | return freezeValue(unsafe.Pointer(&v)) 28 | } 29 | 30 | //go:nosplit 31 | func ptodec(p loader.Function) _Decoder { 32 | return *(*_Decoder)(unsafe.Pointer(&p)) 33 | } 34 | 35 | func assert_eq(v int64, exp int64, msg string) { 36 | if v != exp { 37 | panic(msg) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /internal/decoder/optdec/context.go: -------------------------------------------------------------------------------- 1 | package optdec 2 | 3 | type context = Context 4 | -------------------------------------------------------------------------------- /internal/encoder/alg/opts.go: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package alg 18 | 19 | const ( 20 | BitSortMapKeys = iota 21 | BitEscapeHTML 22 | BitCompactMarshaler 23 | BitNoQuoteTextMarshaler 24 | BitNoNullSliceOrMap 25 | BitValidateString 26 | BitNoValidateJSONMarshaler 27 | BitNoEncoderNewline 28 | BitEncodeNullForInfOrNan 29 | 30 | BitPointerValue = 63 31 | ) 32 | -------------------------------------------------------------------------------- /internal/encoder/encode_norace.go: -------------------------------------------------------------------------------- 1 | //go:build !race 2 | // +build !race 3 | 4 | /* 5 | * Copyright 2021 ByteDance Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | package encoder 21 | 22 | func encodeIntoCheckRace(buf *[]byte, val interface{}, opts Options) error { 23 | return encodeInto(buf, val, opts) 24 | } 25 | -------------------------------------------------------------------------------- /internal/encoder/pools_compt.go: -------------------------------------------------------------------------------- 1 | //go:build !amd64 2 | // +build !amd64 3 | 4 | /* 5 | * Copyright 2021 ByteDance Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | package encoder 21 | 22 | func init() { 23 | ForceUseVM() 24 | } 25 | -------------------------------------------------------------------------------- /internal/envs/decode.go: -------------------------------------------------------------------------------- 1 | package envs 2 | 3 | import ( 4 | "os" 5 | ) 6 | 7 | var UseOptDec = os.Getenv("SONIC_USE_OPTDEC") == "1" 8 | var UseFastMap = os.Getenv("SONIC_USE_FASTMAP") == "1" 9 | 10 | func EnableOptDec() { 11 | UseOptDec = true 12 | } 13 | 14 | func DisableOptDec() { 15 | UseOptDec = false 16 | } 17 | 18 | func EnableFastMap() { 19 | UseFastMap = true 20 | } 21 | 22 | func DisableFastMap() { 23 | UseFastMap = false 24 | } -------------------------------------------------------------------------------- /internal/jit/asm.s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/sonic/a5ac536f86e855ee984145f7426db6bb7998d858/internal/jit/asm.s -------------------------------------------------------------------------------- /internal/jit/backend_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package jit 18 | 19 | import ( 20 | `testing` 21 | 22 | `github.com/davecgh/go-spew/spew` 23 | `github.com/twitchyliquid64/golang-asm/obj` 24 | `github.com/twitchyliquid64/golang-asm/obj/x86` 25 | ) 26 | 27 | func TestBackend(t *testing.T) { 28 | e := newBackend("amd64") 29 | p := e.New() 30 | p.As = x86.AVPTEST 31 | (*BaseAssembler)(nil).assignOperands(p, []obj.Addr{Reg("Y2"), Reg("Y1")}) 32 | e.Append(p) 33 | spew.Dump(e.Assemble()) 34 | } 35 | -------------------------------------------------------------------------------- /internal/native/avx2/f32toa.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package avx2 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_f32toa func(out unsafe.Pointer, val float32) (ret int) 28 | 29 | var S_f32toa uintptr 30 | 31 | //go:nosplit 32 | func f32toa(out *byte, val float32) (ret int) { 33 | return F_f32toa(rt.NoEscape(unsafe.Pointer(out)), val) 34 | } 35 | 36 | -------------------------------------------------------------------------------- /internal/native/avx2/f32toa_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__f32toa = 48 12 | ) 13 | 14 | const ( 15 | _stack__f32toa = 64 16 | ) 17 | 18 | const ( 19 | _size__f32toa = 3792 20 | ) 21 | 22 | var ( 23 | _pcsp__f32toa = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0xe9a, 64}, 32 | {0xe9b, 48}, 33 | {0xe9d, 40}, 34 | {0xe9f, 32}, 35 | {0xea1, 24}, 36 | {0xea3, 16}, 37 | {0xea4, 8}, 38 | {0xea8, 0}, 39 | {0xed0, 64}, 40 | } 41 | ) 42 | 43 | var _cfunc_f32toa = []loader.CFunc{ 44 | {"_f32toa_entry", 0, _entry__f32toa, 0, nil}, 45 | {"_f32toa", _entry__f32toa, _size__f32toa, _stack__f32toa, _pcsp__f32toa}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/avx2/f64toa.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package avx2 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_f64toa func(out unsafe.Pointer, val float64) (ret int) 28 | 29 | var S_f64toa uintptr 30 | 31 | //go:nosplit 32 | func f64toa(out *byte, val float64) (ret int) { 33 | return F_f64toa((rt.NoEscape(unsafe.Pointer(out))), val) 34 | } 35 | 36 | -------------------------------------------------------------------------------- /internal/native/avx2/f64toa_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__f64toa = 48 12 | ) 13 | 14 | const ( 15 | _stack__f64toa = 72 16 | ) 17 | 18 | const ( 19 | _size__f64toa = 5088 20 | ) 21 | 22 | var ( 23 | _pcsp__f64toa = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0x137d, 72}, 32 | {0x137e, 48}, 33 | {0x1380, 40}, 34 | {0x1382, 32}, 35 | {0x1384, 24}, 36 | {0x1386, 16}, 37 | {0x1387, 8}, 38 | {0x138b, 0}, 39 | {0x13e0, 72}, 40 | } 41 | ) 42 | 43 | var _cfunc_f64toa = []loader.CFunc{ 44 | {"_f64toa_entry", 0, _entry__f64toa, 0, nil}, 45 | {"_f64toa", _entry__f64toa, _size__f64toa, _stack__f64toa, _pcsp__f64toa}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/avx2/get_by_path_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__get_by_path = 640 12 | ) 13 | 14 | const ( 15 | _stack__get_by_path = 240 16 | ) 17 | 18 | const ( 19 | _size__get_by_path = 21452 20 | ) 21 | 22 | var ( 23 | _pcsp__get_by_path = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x14, 48}, 31 | {0x4a1c, 240}, 32 | {0x4a1d, 48}, 33 | {0x4a1f, 40}, 34 | {0x4a21, 32}, 35 | {0x4a23, 24}, 36 | {0x4a25, 16}, 37 | {0x4a26, 8}, 38 | {0x4a2a, 0}, 39 | {0x53cc, 240}, 40 | } 41 | ) 42 | 43 | var _cfunc_get_by_path = []loader.CFunc{ 44 | {"_get_by_path_entry", 0, _entry__get_by_path, 0, nil}, 45 | {"_get_by_path", _entry__get_by_path, _size__get_by_path, _stack__get_by_path, _pcsp__get_by_path}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/avx2/html_escape.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package avx2 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_html_escape func(sp unsafe.Pointer, nb int, dp unsafe.Pointer, dn unsafe.Pointer) (ret int) 28 | 29 | var S_html_escape uintptr 30 | 31 | //go:nosplit 32 | func html_escape(sp unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int) (ret int) { 33 | return F_html_escape(rt.NoEscape(sp), nb, dp, rt.NoEscape(unsafe.Pointer(dn))) 34 | } 35 | -------------------------------------------------------------------------------- /internal/native/avx2/html_escape_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__html_escape = 192 12 | ) 13 | 14 | const ( 15 | _stack__html_escape = 72 16 | ) 17 | 18 | const ( 19 | _size__html_escape = 2048 20 | ) 21 | 22 | var ( 23 | _pcsp__html_escape = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0x7e5, 72}, 32 | {0x7e6, 48}, 33 | {0x7e8, 40}, 34 | {0x7ea, 32}, 35 | {0x7ec, 24}, 36 | {0x7ee, 16}, 37 | {0x7ef, 8}, 38 | {0x800, 0}, 39 | } 40 | ) 41 | 42 | var _cfunc_html_escape = []loader.CFunc{ 43 | {"_html_escape_entry", 0, _entry__html_escape, 0, nil}, 44 | {"_html_escape", _entry__html_escape, _size__html_escape, _stack__html_escape, _pcsp__html_escape}, 45 | } 46 | -------------------------------------------------------------------------------- /internal/native/avx2/i64toa.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package avx2 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_i64toa func(out unsafe.Pointer, val int64) (ret int) 28 | 29 | var S_i64toa uintptr 30 | 31 | //go:nosplit 32 | func i64toa(out *byte, val int64) (ret int) { 33 | return F_i64toa(rt.NoEscape(unsafe.Pointer(out)), val) 34 | } 35 | 36 | -------------------------------------------------------------------------------- /internal/native/avx2/i64toa_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__i64toa = 64 12 | ) 13 | 14 | const ( 15 | _stack__i64toa = 8 16 | ) 17 | 18 | const ( 19 | _size__i64toa = 2272 20 | ) 21 | 22 | var ( 23 | _pcsp__i64toa = [][2]uint32{ 24 | {0x1, 0}, 25 | {0xae, 8}, 26 | {0xaf, 0}, 27 | {0x201, 8}, 28 | {0x202, 0}, 29 | {0x287, 8}, 30 | {0x288, 0}, 31 | {0x456, 8}, 32 | {0x457, 0}, 33 | {0x4e2, 8}, 34 | {0x4e3, 0}, 35 | {0x610, 8}, 36 | {0x611, 0}, 37 | {0x771, 8}, 38 | {0x772, 0}, 39 | {0x8d9, 8}, 40 | {0x8e0, 0}, 41 | } 42 | ) 43 | 44 | var _cfunc_i64toa = []loader.CFunc{ 45 | {"_i64toa_entry", 0, _entry__i64toa, 0, nil}, 46 | {"_i64toa", _entry__i64toa, _size__i64toa, _stack__i64toa, _pcsp__i64toa}, 47 | } 48 | -------------------------------------------------------------------------------- /internal/native/avx2/lookup_small_key_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__lookup_small_key = 96 12 | ) 13 | 14 | const ( 15 | _stack__lookup_small_key = 56 16 | ) 17 | 18 | const ( 19 | _size__lookup_small_key = 810 20 | ) 21 | 22 | var ( 23 | _pcsp__lookup_small_key = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0xe, 48}, 31 | {0x2fc, 56}, 32 | {0x2fd, 48}, 33 | {0x2ff, 40}, 34 | {0x301, 32}, 35 | {0x303, 24}, 36 | {0x305, 16}, 37 | {0x306, 8}, 38 | {0x30a, 0}, 39 | {0x32a, 56}, 40 | } 41 | ) 42 | 43 | var _cfunc_lookup_small_key = []loader.CFunc{ 44 | {"_lookup_small_key_entry", 0, _entry__lookup_small_key, 0, nil}, 45 | {"_lookup_small_key", _entry__lookup_small_key, _size__lookup_small_key, _stack__lookup_small_key, _pcsp__lookup_small_key}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/avx2/lspace.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package avx2 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_lspace func(sp unsafe.Pointer, nb int, off int) (ret int) 28 | 29 | var S_lspace uintptr 30 | 31 | //go:nosplit 32 | func lspace(sp *byte, nb int, off int) (ret int) { 33 | return F_lspace(rt.NoEscape(unsafe.Pointer(sp)), nb, off) 34 | } 35 | 36 | -------------------------------------------------------------------------------- /internal/native/avx2/lspace_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__lspace = 32 12 | ) 13 | 14 | const ( 15 | _stack__lspace = 8 16 | ) 17 | 18 | const ( 19 | _size__lspace = 232 20 | ) 21 | 22 | var ( 23 | _pcsp__lspace = [][2]uint32{ 24 | {0x1, 0}, 25 | {0xbb, 8}, 26 | {0xbf, 0}, 27 | {0xc8, 8}, 28 | {0xcc, 0}, 29 | {0xd3, 8}, 30 | {0xd7, 0}, 31 | {0xe8, 8}, 32 | } 33 | ) 34 | 35 | var _cfunc_lspace = []loader.CFunc{ 36 | {"_lspace_entry", 0, _entry__lspace, 0, nil}, 37 | {"_lspace", _entry__lspace, _size__lspace, _stack__lspace, _pcsp__lspace}, 38 | } 39 | -------------------------------------------------------------------------------- /internal/native/avx2/parse_with_padding.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | // Code generated by Makefile, DO NOT EDIT. 4 | 5 | /* 6 | * Copyright 2021 ByteDance Inc. 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package avx2 22 | 23 | import ( 24 | `unsafe` 25 | 26 | `github.com/bytedance/sonic/internal/rt` 27 | ) 28 | 29 | var F_parse_with_padding func(parser unsafe.Pointer) (ret int) 30 | 31 | var S_parse_with_padding uintptr 32 | 33 | //go:nosplit 34 | func parse_with_padding(parser unsafe.Pointer) (ret int) { 35 | return F_parse_with_padding(rt.NoEscape(parser)) 36 | } 37 | -------------------------------------------------------------------------------- /internal/native/avx2/parse_with_padding_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__parse_with_padding = 688 12 | ) 13 | 14 | const ( 15 | _stack__parse_with_padding = 200 16 | ) 17 | 18 | const ( 19 | _size__parse_with_padding = 48876 20 | ) 21 | 22 | var ( 23 | _pcsp__parse_with_padding = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x14, 48}, 31 | {0xbea, 200}, 32 | {0xbeb, 48}, 33 | {0xbed, 40}, 34 | {0xbef, 32}, 35 | {0xbf1, 24}, 36 | {0xbf3, 16}, 37 | {0xbf4, 8}, 38 | {0xbf8, 0}, 39 | {0xbeec, 200}, 40 | } 41 | ) 42 | 43 | var _cfunc_parse_with_padding = []loader.CFunc{ 44 | {"_parse_with_padding_entry", 0, _entry__parse_with_padding, 0, nil}, 45 | {"_parse_with_padding", _entry__parse_with_padding, _size__parse_with_padding, _stack__parse_with_padding, _pcsp__parse_with_padding}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/avx2/quote_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__quote = 144 12 | ) 13 | 14 | const ( 15 | _stack__quote = 72 16 | ) 17 | 18 | const ( 19 | _size__quote = 2880 20 | ) 21 | 22 | var ( 23 | _pcsp__quote = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0xb10, 72}, 32 | {0xb11, 48}, 33 | {0xb13, 40}, 34 | {0xb15, 32}, 35 | {0xb17, 24}, 36 | {0xb19, 16}, 37 | {0xb1a, 8}, 38 | {0xb1e, 0}, 39 | {0xb40, 72}, 40 | } 41 | ) 42 | 43 | var _cfunc_quote = []loader.CFunc{ 44 | {"_quote_entry", 0, _entry__quote, 0, nil}, 45 | {"_quote", _entry__quote, _size__quote, _stack__quote, _pcsp__quote}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/avx2/skip_array_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__skip_array = 704 12 | ) 13 | 14 | const ( 15 | _stack__skip_array = 208 16 | ) 17 | 18 | const ( 19 | _size__skip_array = 15136 20 | ) 21 | 22 | var ( 23 | _pcsp__skip_array = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x14, 48}, 31 | {0x38dd, 208}, 32 | {0x38de, 48}, 33 | {0x38e0, 40}, 34 | {0x38e2, 32}, 35 | {0x38e4, 24}, 36 | {0x38e6, 16}, 37 | {0x38e7, 8}, 38 | {0x38eb, 0}, 39 | {0x3b20, 208}, 40 | } 41 | ) 42 | 43 | var _cfunc_skip_array = []loader.CFunc{ 44 | {"_skip_array_entry", 0, _entry__skip_array, 0, nil}, 45 | {"_skip_array", _entry__skip_array, _size__skip_array, _stack__skip_array, _pcsp__skip_array}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/avx2/skip_number.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License ); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package avx2 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_skip_number func(s unsafe.Pointer, p unsafe.Pointer) (ret int) 28 | 29 | var S_skip_number uintptr 30 | 31 | //go:nosplit 32 | func skip_number(s *string, p *int) (ret int) { 33 | return F_skip_number(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p))) 34 | } 35 | -------------------------------------------------------------------------------- /internal/native/avx2/skip_number_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__skip_number = 336 12 | ) 13 | 14 | const ( 15 | _stack__skip_number = 88 16 | ) 17 | 18 | const ( 19 | _size__skip_number = 1528 20 | ) 21 | 22 | var ( 23 | _pcsp__skip_number = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0x5bb, 88}, 32 | {0x5bc, 48}, 33 | {0x5be, 40}, 34 | {0x5c0, 32}, 35 | {0x5c2, 24}, 36 | {0x5c4, 16}, 37 | {0x5c5, 8}, 38 | {0x5c9, 0}, 39 | {0x5f8, 88}, 40 | } 41 | ) 42 | 43 | var _cfunc_skip_number = []loader.CFunc{ 44 | {"_skip_number_entry", 0, _entry__skip_number, 0, nil}, 45 | {"_skip_number", _entry__skip_number, _size__skip_number, _stack__skip_number, _pcsp__skip_number}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/avx2/skip_object_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__skip_object = 704 12 | ) 13 | 14 | const ( 15 | _stack__skip_object = 208 16 | ) 17 | 18 | const ( 19 | _size__skip_object = 15136 20 | ) 21 | 22 | var ( 23 | _pcsp__skip_object = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x14, 48}, 31 | {0x38dd, 208}, 32 | {0x38de, 48}, 33 | {0x38e0, 40}, 34 | {0x38e2, 32}, 35 | {0x38e4, 24}, 36 | {0x38e6, 16}, 37 | {0x38e7, 8}, 38 | {0x38eb, 0}, 39 | {0x3b20, 208}, 40 | } 41 | ) 42 | 43 | var _cfunc_skip_object = []loader.CFunc{ 44 | {"_skip_object_entry", 0, _entry__skip_object, 0, nil}, 45 | {"_skip_object", _entry__skip_object, _size__skip_object, _stack__skip_object, _pcsp__skip_object}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/avx2/skip_one_fast.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package avx2 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_skip_one_fast func(s unsafe.Pointer, p unsafe.Pointer) (ret int) 28 | 29 | var S_skip_one_fast uintptr 30 | 31 | //go:nosplit 32 | func skip_one_fast(s *string, p *int) (ret int) { 33 | return F_skip_one_fast(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p))) 34 | } 35 | 36 | -------------------------------------------------------------------------------- /internal/native/avx2/skip_one_fast_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__skip_one_fast = 336 12 | ) 13 | 14 | const ( 15 | _stack__skip_one_fast = 176 16 | ) 17 | 18 | const ( 19 | _size__skip_one_fast = 2824 20 | ) 21 | 22 | var ( 23 | _pcsp__skip_one_fast = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x14, 48}, 31 | {0x32c, 176}, 32 | {0x32d, 48}, 33 | {0x32f, 40}, 34 | {0x331, 32}, 35 | {0x333, 24}, 36 | {0x335, 16}, 37 | {0x336, 8}, 38 | {0x33a, 0}, 39 | {0xb08, 176}, 40 | } 41 | ) 42 | 43 | var _cfunc_skip_one_fast = []loader.CFunc{ 44 | {"_skip_one_fast_entry", 0, _entry__skip_one_fast, 0, nil}, 45 | {"_skip_one_fast", _entry__skip_one_fast, _size__skip_one_fast, _stack__skip_one_fast, _pcsp__skip_one_fast}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/avx2/skip_one_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__skip_one = 672 12 | ) 13 | 14 | const ( 15 | _stack__skip_one = 208 16 | ) 17 | 18 | const ( 19 | _size__skip_one = 13564 20 | ) 21 | 22 | var ( 23 | _pcsp__skip_one = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x14, 48}, 31 | {0x323f, 208}, 32 | {0x3240, 48}, 33 | {0x3242, 40}, 34 | {0x3244, 32}, 35 | {0x3246, 24}, 36 | {0x3248, 16}, 37 | {0x3249, 8}, 38 | {0x324d, 0}, 39 | {0x34fc, 208}, 40 | } 41 | ) 42 | 43 | var _cfunc_skip_one = []loader.CFunc{ 44 | {"_skip_one_entry", 0, _entry__skip_one, 0, nil}, 45 | {"_skip_one", _entry__skip_one, _size__skip_one, _stack__skip_one, _pcsp__skip_one}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/avx2/u64toa.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package avx2 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_u64toa func(out unsafe.Pointer, val uint64) (ret int) 28 | 29 | var S_u64toa uintptr 30 | 31 | //go:nosplit 32 | func u64toa(out *byte, val uint64) (ret int) { 33 | return F_u64toa(rt.NoEscape(unsafe.Pointer(out)), val) 34 | } 35 | -------------------------------------------------------------------------------- /internal/native/avx2/u64toa_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__u64toa = 64 12 | ) 13 | 14 | const ( 15 | _stack__u64toa = 8 16 | ) 17 | 18 | const ( 19 | _size__u64toa = 1216 20 | ) 21 | 22 | var ( 23 | _pcsp__u64toa = [][2]uint32{ 24 | {0x1, 0}, 25 | {0xa5, 8}, 26 | {0xa6, 0}, 27 | {0x1cf, 8}, 28 | {0x1d0, 0}, 29 | {0x2f9, 8}, 30 | {0x2fa, 0}, 31 | {0x4b7, 8}, 32 | {0x4c0, 0}, 33 | } 34 | ) 35 | 36 | var _cfunc_u64toa = []loader.CFunc{ 37 | {"_u64toa_entry", 0, _entry__u64toa, 0, nil}, 38 | {"_u64toa", _entry__u64toa, _size__u64toa, _stack__u64toa, _pcsp__u64toa}, 39 | } 40 | -------------------------------------------------------------------------------- /internal/native/avx2/unquote_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__unquote = 48 12 | ) 13 | 14 | const ( 15 | _stack__unquote = 80 16 | ) 17 | 18 | const ( 19 | _size__unquote = 2288 20 | ) 21 | 22 | var ( 23 | _pcsp__unquote = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0x5f8, 80}, 32 | {0x5f9, 48}, 33 | {0x5fb, 40}, 34 | {0x5fd, 32}, 35 | {0x5ff, 24}, 36 | {0x601, 16}, 37 | {0x602, 8}, 38 | {0x606, 0}, 39 | {0x8f0, 80}, 40 | } 41 | ) 42 | 43 | var _cfunc_unquote = []loader.CFunc{ 44 | {"_unquote_entry", 0, _entry__unquote, 0, nil}, 45 | {"_unquote", _entry__unquote, _size__unquote, _stack__unquote, _pcsp__unquote}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/avx2/validate_one_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__validate_one = 704 12 | ) 13 | 14 | const ( 15 | _stack__validate_one = 208 16 | ) 17 | 18 | const ( 19 | _size__validate_one = 15136 20 | ) 21 | 22 | var ( 23 | _pcsp__validate_one = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x14, 48}, 31 | {0x38dd, 208}, 32 | {0x38de, 48}, 33 | {0x38e0, 40}, 34 | {0x38e2, 32}, 35 | {0x38e4, 24}, 36 | {0x38e6, 16}, 37 | {0x38e7, 8}, 38 | {0x38eb, 0}, 39 | {0x3b20, 208}, 40 | } 41 | ) 42 | 43 | var _cfunc_validate_one = []loader.CFunc{ 44 | {"_validate_one_entry", 0, _entry__validate_one, 0, nil}, 45 | {"_validate_one", _entry__validate_one, _size__validate_one, _stack__validate_one, _pcsp__validate_one}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/avx2/validate_utf8_fast.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package avx2 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_validate_utf8_fast func(s unsafe.Pointer) (ret int) 28 | 29 | var S_validate_utf8_fast uintptr 30 | 31 | //go:nosplit 32 | func validate_utf8_fast(s *string) (ret int) { 33 | return F_validate_utf8_fast(rt.NoEscape(unsafe.Pointer(s))) 34 | } 35 | -------------------------------------------------------------------------------- /internal/native/avx2/validate_utf8_fast_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__validate_utf8_fast = 272 12 | ) 13 | 14 | const ( 15 | _stack__validate_utf8_fast = 176 16 | ) 17 | 18 | const ( 19 | _size__validate_utf8_fast = 2656 20 | ) 21 | 22 | var ( 23 | _pcsp__validate_utf8_fast = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x5, 8}, 26 | {0xc, 16}, 27 | {0x6aa, 176}, 28 | {0x6ab, 16}, 29 | {0x6ac, 8}, 30 | {0x6b0, 0}, 31 | {0x7d3, 176}, 32 | {0x7d4, 16}, 33 | {0x7d5, 8}, 34 | {0x7d9, 0}, 35 | {0xa60, 176}, 36 | } 37 | ) 38 | 39 | var _cfunc_validate_utf8_fast = []loader.CFunc{ 40 | {"_validate_utf8_fast_entry", 0, _entry__validate_utf8_fast, 0, nil}, 41 | {"_validate_utf8_fast", _entry__validate_utf8_fast, _size__validate_utf8_fast, _stack__validate_utf8_fast, _pcsp__validate_utf8_fast}, 42 | } 43 | -------------------------------------------------------------------------------- /internal/native/avx2/validate_utf8_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__validate_utf8 = 0 12 | ) 13 | 14 | const ( 15 | _stack__validate_utf8 = 48 16 | ) 17 | 18 | const ( 19 | _size__validate_utf8 = 684 20 | ) 21 | 22 | var ( 23 | _pcsp__validate_utf8 = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xb, 32}, 29 | {0xc, 40}, 30 | {0x283, 48}, 31 | {0x284, 40}, 32 | {0x286, 32}, 33 | {0x288, 24}, 34 | {0x28a, 16}, 35 | {0x28b, 8}, 36 | {0x28c, 0}, 37 | {0x2ac, 48}, 38 | } 39 | ) 40 | 41 | var _cfunc_validate_utf8 = []loader.CFunc{ 42 | {"_validate_utf8_entry", 0, _entry__validate_utf8, 0, nil}, 43 | {"_validate_utf8", _entry__validate_utf8, _size__validate_utf8, _stack__validate_utf8, _pcsp__validate_utf8}, 44 | } 45 | -------------------------------------------------------------------------------- /internal/native/avx2/value_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__value = 576 12 | ) 13 | 14 | const ( 15 | _stack__value = 128 16 | ) 17 | 18 | const ( 19 | _size__value = 12468 20 | ) 21 | 22 | var ( 23 | _pcsp__value = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0x10cf, 128}, 32 | {0x10d0, 48}, 33 | {0x10d2, 40}, 34 | {0x10d4, 32}, 35 | {0x10d6, 24}, 36 | {0x10d8, 16}, 37 | {0x10d9, 8}, 38 | {0x10dd, 0}, 39 | {0x30b4, 128}, 40 | } 41 | ) 42 | 43 | var _cfunc_value = []loader.CFunc{ 44 | {"_value_entry", 0, _entry__value, 0, nil}, 45 | {"_value", _entry__value, _size__value, _stack__value, _pcsp__value}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/avx2/vnumber.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package avx2 18 | 19 | import ( 20 | `unsafe` 21 | 22 | `github.com/bytedance/sonic/internal/native/types` 23 | `github.com/bytedance/sonic/internal/rt` 24 | ) 25 | 26 | var F_vnumber func(s unsafe.Pointer, p unsafe.Pointer, v unsafe.Pointer) 27 | 28 | var S_vnumber uintptr 29 | 30 | //go:nosplit 31 | func vnumber(s *string, p *int, v *types.JsonState) { 32 | F_vnumber(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p)), rt.NoEscape(unsafe.Pointer(v))) 33 | } 34 | -------------------------------------------------------------------------------- /internal/native/avx2/vnumber_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__vnumber = 128 12 | ) 13 | 14 | const ( 15 | _stack__vnumber = 136 16 | ) 17 | 18 | const ( 19 | _size__vnumber = 8496 20 | ) 21 | 22 | var ( 23 | _pcsp__vnumber = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0x211f, 136}, 32 | {0x2120, 48}, 33 | {0x2122, 40}, 34 | {0x2124, 32}, 35 | {0x2126, 24}, 36 | {0x2128, 16}, 37 | {0x2129, 8}, 38 | {0x2130, 0}, 39 | } 40 | ) 41 | 42 | var _cfunc_vnumber = []loader.CFunc{ 43 | {"_vnumber_entry", 0, _entry__vnumber, 0, nil}, 44 | {"_vnumber", _entry__vnumber, _size__vnumber, _stack__vnumber, _pcsp__vnumber}, 45 | } 46 | -------------------------------------------------------------------------------- /internal/native/avx2/vsigned.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package avx2 18 | 19 | import ( 20 | `unsafe` 21 | 22 | `github.com/bytedance/sonic/internal/native/types` 23 | `github.com/bytedance/sonic/internal/rt` 24 | ) 25 | 26 | var F_vsigned func(s unsafe.Pointer, p unsafe.Pointer, v unsafe.Pointer) 27 | 28 | var S_vsigned uintptr 29 | 30 | //go:nosplit 31 | func vsigned(s *string, p *int, v *types.JsonState) { 32 | F_vsigned(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p)), rt.NoEscape(unsafe.Pointer(v))) 33 | } 34 | -------------------------------------------------------------------------------- /internal/native/avx2/vsigned_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__vsigned = 0 12 | ) 13 | 14 | const ( 15 | _stack__vsigned = 16 16 | ) 17 | 18 | const ( 19 | _size__vsigned = 356 20 | ) 21 | 22 | var ( 23 | _pcsp__vsigned = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x5, 8}, 26 | {0x72, 16}, 27 | {0x73, 8}, 28 | {0x74, 0}, 29 | {0x7f, 16}, 30 | {0x80, 8}, 31 | {0x81, 0}, 32 | {0x117, 16}, 33 | {0x118, 8}, 34 | {0x119, 0}, 35 | {0x11d, 16}, 36 | {0x11e, 8}, 37 | {0x11f, 0}, 38 | {0x155, 16}, 39 | {0x156, 8}, 40 | {0x157, 0}, 41 | {0x162, 16}, 42 | {0x163, 8}, 43 | {0x164, 0}, 44 | } 45 | ) 46 | 47 | var _cfunc_vsigned = []loader.CFunc{ 48 | {"_vsigned_entry", 0, _entry__vsigned, 0, nil}, 49 | {"_vsigned", _entry__vsigned, _size__vsigned, _stack__vsigned, _pcsp__vsigned}, 50 | } 51 | -------------------------------------------------------------------------------- /internal/native/avx2/vstring_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package avx2 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__vstring = 96 12 | ) 13 | 14 | const ( 15 | _stack__vstring = 72 16 | ) 17 | 18 | const ( 19 | _size__vstring = 1832 20 | ) 21 | 22 | var ( 23 | _pcsp__vstring = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0x679, 72}, 32 | {0x67a, 48}, 33 | {0x67c, 40}, 34 | {0x67e, 32}, 35 | {0x680, 24}, 36 | {0x682, 16}, 37 | {0x683, 8}, 38 | {0x687, 0}, 39 | {0x728, 72}, 40 | } 41 | ) 42 | 43 | var _cfunc_vstring = []loader.CFunc{ 44 | {"_vstring_entry", 0, _entry__vstring, 0, nil}, 45 | {"_vstring", _entry__vstring, _size__vstring, _stack__vstring, _pcsp__vstring}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/avx2/vunsigned.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package avx2 18 | 19 | import ( 20 | `unsafe` 21 | 22 | `github.com/bytedance/sonic/internal/native/types` 23 | `github.com/bytedance/sonic/internal/rt` 24 | ) 25 | 26 | var F_vunsigned func(s unsafe.Pointer, p unsafe.Pointer, v unsafe.Pointer) 27 | 28 | var S_vunsigned uintptr 29 | 30 | //go:nosplit 31 | func vunsigned(s *string, p *int, v *types.JsonState) { 32 | F_vunsigned(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p)), rt.NoEscape(unsafe.Pointer(v))) 33 | } 34 | -------------------------------------------------------------------------------- /internal/native/f32toa.tmpl: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package {{PACKAGE}} 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_f32toa func(out unsafe.Pointer, val float32) (ret int) 28 | 29 | var S_f32toa uintptr 30 | 31 | //go:nosplit 32 | func f32toa(out *byte, val float32) (ret int) { 33 | return F_f32toa(rt.NoEscape(unsafe.Pointer(out)), val) 34 | } 35 | 36 | -------------------------------------------------------------------------------- /internal/native/f64toa.tmpl: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package {{PACKAGE}} 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_f64toa func(out unsafe.Pointer, val float64) (ret int) 28 | 29 | var S_f64toa uintptr 30 | 31 | //go:nosplit 32 | func f64toa(out *byte, val float64) (ret int) { 33 | return F_f64toa((rt.NoEscape(unsafe.Pointer(out))), val) 34 | } 35 | 36 | -------------------------------------------------------------------------------- /internal/native/i64toa.tmpl: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package {{PACKAGE}} 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_i64toa func(out unsafe.Pointer, val int64) (ret int) 28 | 29 | var S_i64toa uintptr 30 | 31 | //go:nosplit 32 | func i64toa(out *byte, val int64) (ret int) { 33 | return F_i64toa(rt.NoEscape(unsafe.Pointer(out)), val) 34 | } 35 | 36 | -------------------------------------------------------------------------------- /internal/native/lspace.tmpl: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package {{PACKAGE}} 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_lspace func(sp unsafe.Pointer, nb int, off int) (ret int) 28 | 29 | var S_lspace uintptr 30 | 31 | //go:nosplit 32 | func lspace(sp *byte, nb int, off int) (ret int) { 33 | return F_lspace(rt.NoEscape(unsafe.Pointer(sp)), nb, off) 34 | } 35 | 36 | -------------------------------------------------------------------------------- /internal/native/neon/f32toa_arm64.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package neon 20 | 21 | //go:nosplit 22 | func f32toa(out *byte, val float32) (ret int) { 23 | return __f32toa(out, val) 24 | } 25 | 26 | //go:nosplit 27 | //go:noescape 28 | //goland:noinspection GoUnusedParameter 29 | func __f32toa(out *byte, val float32) (ret int) 30 | -------------------------------------------------------------------------------- /internal/native/neon/f32toa_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __f32toa_entry__() uintptr 10 | 11 | var ( 12 | _subr__f32toa uintptr = __f32toa_entry__() + 0 13 | ) 14 | 15 | const ( 16 | _stack__f32toa = 32 17 | ) 18 | 19 | var ( 20 | _ = _subr__f32toa 21 | ) 22 | 23 | const ( 24 | _ = _stack__f32toa 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/f64toa_arm64.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package neon 20 | 21 | //go:nosplit 22 | func f64toa(out *byte, val float64) (ret int) { 23 | return __f64toa(out, val) 24 | } 25 | 26 | //go:nosplit 27 | //go:noescape 28 | //goland:noinspection GoUnusedParameter 29 | func __f64toa(out *byte, val float64) (ret int) 30 | -------------------------------------------------------------------------------- /internal/native/neon/f64toa_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __f64toa_entry__() uintptr 10 | 11 | var ( 12 | _subr__f64toa uintptr = __f64toa_entry__() + 0 13 | ) 14 | 15 | const ( 16 | _stack__f64toa = 32 17 | ) 18 | 19 | var ( 20 | _ = _subr__f64toa 21 | ) 22 | 23 | const ( 24 | _ = _stack__f64toa 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/get_by_path_arm64.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package neon 20 | 21 | import ( 22 | `github.com/bytedance/sonic/internal/native/types` 23 | ) 24 | 25 | //go:nosplit 26 | func get_by_path(s *string, p *int, path *[]interface{}, m *types.StateMachine) (ret int) { 27 | return __get_by_path(s, p, path, m) 28 | } 29 | 30 | //go:nosplit 31 | //go:noescape 32 | //goland:noinspection GoUnusedParameter 33 | func __get_by_path(s *string, p *int, path *[]interface{}, m *types.StateMachine) (ret int) 34 | -------------------------------------------------------------------------------- /internal/native/neon/get_by_path_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __get_by_path_entry__() uintptr 10 | 11 | var ( 12 | _subr__get_by_path uintptr = __get_by_path_entry__() + 48 13 | ) 14 | 15 | const ( 16 | _stack__get_by_path = 208 17 | ) 18 | 19 | var ( 20 | _ = _subr__get_by_path 21 | ) 22 | 23 | const ( 24 | _ = _stack__get_by_path 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/html_escape_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __html_escape_entry__() uintptr 10 | 11 | var ( 12 | _subr__html_escape uintptr = __html_escape_entry__() + 32 13 | ) 14 | 15 | const ( 16 | _stack__html_escape = 32 17 | ) 18 | 19 | var ( 20 | _ = _subr__html_escape 21 | ) 22 | 23 | const ( 24 | _ = _stack__html_escape 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/i64toa_arm64.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package neon 20 | 21 | //go:nosplit 22 | func i64toa(out *byte, val int64) (ret int) { 23 | return __i64toa(out, val) 24 | } 25 | 26 | //go:nosplit 27 | //go:noescape 28 | //goland:noinspection GoUnusedParameter 29 | func __i64toa(out *byte, val int64) (ret int) 30 | -------------------------------------------------------------------------------- /internal/native/neon/i64toa_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __i64toa_entry__() uintptr 10 | 11 | var ( 12 | _subr__i64toa uintptr = __i64toa_entry__() + 48 13 | ) 14 | 15 | const ( 16 | _stack__i64toa = 32 17 | ) 18 | 19 | var ( 20 | _ = _subr__i64toa 21 | ) 22 | 23 | const ( 24 | _ = _stack__i64toa 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/lookup_small_key_arm64.go: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package neon 18 | 19 | import ( 20 | "unsafe" 21 | 22 | "github.com/bytedance/sonic/internal/rt" 23 | ) 24 | 25 | //go:nosplit 26 | func lookup_small_key(key *string, table *[]byte, lowerOff int) (ret int) { 27 | return __lookup_small_key(rt.NoEscape(unsafe.Pointer(key)), rt.NoEscape(unsafe.Pointer(table)), lowerOff) 28 | } 29 | 30 | //go:nosplit 31 | func __lookup_small_key(key unsafe.Pointer, table unsafe.Pointer, lowerOff int) (ret int) 32 | -------------------------------------------------------------------------------- /internal/native/neon/lookup_small_key_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __lookup_small_key_entry__() uintptr 10 | 11 | var ( 12 | _subr__lookup_small_key uintptr = __lookup_small_key_entry__() + 32 13 | ) 14 | 15 | const ( 16 | _stack__lookup_small_key = 32 17 | ) 18 | 19 | var ( 20 | _ = _subr__lookup_small_key 21 | ) 22 | 23 | const ( 24 | _ = _stack__lookup_small_key 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/lspace_arm64.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package neon 20 | 21 | import ( 22 | `unsafe` 23 | 24 | // `github.com/bytedance/sonic/internal/native/types` 25 | ) 26 | 27 | //go:nosplit 28 | func lspace(sp unsafe.Pointer, nb int, off int) (ret int) { 29 | return __lspace(sp, nb, off) 30 | } 31 | 32 | //go:nosplit 33 | //go:noescape 34 | //goland:noinspection GoUnusedParameter 35 | func __lspace(sp unsafe.Pointer, nb int, off int) (ret int) 36 | -------------------------------------------------------------------------------- /internal/native/neon/lspace_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __lspace_entry__() uintptr 10 | 11 | var ( 12 | _subr__lspace uintptr = __lspace_entry__() + 0 13 | ) 14 | 15 | const ( 16 | _stack__lspace = 32 17 | ) 18 | 19 | var ( 20 | _ = _subr__lspace 21 | ) 22 | 23 | const ( 24 | _ = _stack__lspace 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/parse_with_padding_arm64.go: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package neon 18 | 19 | import ( 20 | "unsafe" 21 | 22 | "github.com/bytedance/sonic/internal/rt" 23 | ) 24 | 25 | //go:nosplit 26 | func parse_with_padding(parser unsafe.Pointer) (ret int) { 27 | return __parse_with_padding(rt.NoEscape(parser)) 28 | } 29 | 30 | func __parse_with_padding(parser unsafe.Pointer) (ret int) 31 | -------------------------------------------------------------------------------- /internal/native/neon/parse_with_padding_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __parse_with_padding_entry__() uintptr 10 | 11 | var ( 12 | _subr__parse_with_padding uintptr = __parse_with_padding_entry__() + 248 13 | ) 14 | 15 | const ( 16 | _stack__parse_with_padding = 160 17 | ) 18 | 19 | var ( 20 | _ = _subr__parse_with_padding 21 | ) 22 | 23 | const ( 24 | _ = _stack__parse_with_padding 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/quote_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __quote_entry__() uintptr 10 | 11 | var ( 12 | _subr__quote uintptr = __quote_entry__() + 32 13 | ) 14 | 15 | const ( 16 | _stack__quote = 32 17 | ) 18 | 19 | var ( 20 | _ = _subr__quote 21 | ) 22 | 23 | const ( 24 | _ = _stack__quote 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/skip_array_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __skip_array_entry__() uintptr 10 | 11 | var ( 12 | _subr__skip_array uintptr = __skip_array_entry__() + 48 13 | ) 14 | 15 | const ( 16 | _stack__skip_array = 240 17 | ) 18 | 19 | var ( 20 | _ = _subr__skip_array 21 | ) 22 | 23 | const ( 24 | _ = _stack__skip_array 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/skip_number_arm64.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package neon 20 | 21 | //go:nosplit 22 | func skip_number(s *string, p *int) (ret int) { 23 | return __skip_number(s, p) 24 | } 25 | 26 | //go:nosplit 27 | //go:noescape 28 | //goland:noinspection GoUnusedParameter 29 | func __skip_number(s *string, p *int) (ret int) 30 | -------------------------------------------------------------------------------- /internal/native/neon/skip_number_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __skip_number_entry__() uintptr 10 | 11 | var ( 12 | _subr__skip_number uintptr = __skip_number_entry__() + 32 13 | ) 14 | 15 | const ( 16 | _stack__skip_number = 48 17 | ) 18 | 19 | var ( 20 | _ = _subr__skip_number 21 | ) 22 | 23 | const ( 24 | _ = _stack__skip_number 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/skip_object_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __skip_object_entry__() uintptr 10 | 11 | var ( 12 | _subr__skip_object uintptr = __skip_object_entry__() + 48 13 | ) 14 | 15 | const ( 16 | _stack__skip_object = 240 17 | ) 18 | 19 | var ( 20 | _ = _subr__skip_object 21 | ) 22 | 23 | const ( 24 | _ = _stack__skip_object 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/skip_one_arm64.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package neon 20 | 21 | import ( 22 | // `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/native/types` 25 | ) 26 | 27 | //go:nosplit 28 | //go:noescape 29 | //goland:noinspection GoUnusedParameter 30 | func __skip_one(s *string, p *int, m *types.StateMachine, flags uint64) (ret int) 31 | 32 | //go:nosplit 33 | func skip_one(s *string, p *int, m *types.StateMachine, flags uint64) (ret int) { 34 | return __skip_one(s, p, m, flags) 35 | } 36 | -------------------------------------------------------------------------------- /internal/native/neon/skip_one_fast_arm64.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package neon 20 | 21 | //go:nosplit 22 | func skip_one_fast(s *string, p *int) (ret int) { 23 | return __skip_one_fast(s, p) 24 | } 25 | 26 | //go:nosplit 27 | //go:noescape 28 | //goland:noinspection GoUnusedParameter 29 | func __skip_one_fast(s *string, p *int) (ret int) 30 | -------------------------------------------------------------------------------- /internal/native/neon/skip_one_fast_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __skip_one_fast_entry__() uintptr 10 | 11 | var ( 12 | _subr__skip_one_fast uintptr = __skip_one_fast_entry__() + 32 13 | ) 14 | 15 | const ( 16 | _stack__skip_one_fast = 192 17 | ) 18 | 19 | var ( 20 | _ = _subr__skip_one_fast 21 | ) 22 | 23 | const ( 24 | _ = _stack__skip_one_fast 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/skip_one_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __skip_one_entry__() uintptr 10 | 11 | var ( 12 | _subr__skip_one uintptr = __skip_one_entry__() + 48 13 | ) 14 | 15 | const ( 16 | _stack__skip_one = 192 17 | ) 18 | 19 | var ( 20 | _ = _subr__skip_one 21 | ) 22 | 23 | const ( 24 | _ = _stack__skip_one 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/u64toa_arm64.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package neon 20 | 21 | //go:nosplit 22 | func u64toa(out *byte, val uint64) (ret int) { 23 | return __u64toa(out, val) 24 | } 25 | 26 | //go:nosplit 27 | //go:noescape 28 | //goland:noinspection GoUnusedParameter 29 | func __u64toa(out *byte, val uint64) (ret int) 30 | -------------------------------------------------------------------------------- /internal/native/neon/u64toa_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __u64toa_entry__() uintptr 10 | 11 | var ( 12 | _subr__u64toa uintptr = __u64toa_entry__() + 48 13 | ) 14 | 15 | const ( 16 | _stack__u64toa = 32 17 | ) 18 | 19 | var ( 20 | _ = _subr__u64toa 21 | ) 22 | 23 | const ( 24 | _ = _stack__u64toa 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/unquote_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __unquote_entry__() uintptr 10 | 11 | var ( 12 | _subr__unquote uintptr = __unquote_entry__() + 32 13 | ) 14 | 15 | const ( 16 | _stack__unquote = 112 17 | ) 18 | 19 | var ( 20 | _ = _subr__unquote 21 | ) 22 | 23 | const ( 24 | _ = _stack__unquote 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/validate_one_arm64.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package neon 20 | 21 | import ( 22 | // `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/native/types` 25 | ) 26 | 27 | //go:nosplit 28 | func validate_one(s *string, p *int, m *types.StateMachine) (ret int) { 29 | return __validate_one(s, p, m) 30 | } 31 | 32 | //go:nosplit 33 | //go:noescape 34 | //goland:noinspection GoUnusedParameter 35 | func __validate_one(s *string, p *int, m *types.StateMachine) (ret int) 36 | -------------------------------------------------------------------------------- /internal/native/neon/validate_one_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __validate_one_entry__() uintptr 10 | 11 | var ( 12 | _subr__validate_one uintptr = __validate_one_entry__() + 48 13 | ) 14 | 15 | const ( 16 | _stack__validate_one = 240 17 | ) 18 | 19 | var ( 20 | _ = _subr__validate_one 21 | ) 22 | 23 | const ( 24 | _ = _stack__validate_one 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/validate_utf8_arm64.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package neon 20 | 21 | import ( 22 | // `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/native/types` 25 | ) 26 | 27 | //go:nosplit 28 | func validate_utf8(s *string, p *int, m *types.StateMachine) (ret int) { 29 | return __validate_utf8(s, p, m) 30 | } 31 | 32 | //go:nosplit 33 | //go:noescape 34 | //goland:noinspection GoUnusedParameter 35 | func __validate_utf8(s *string, p *int, m *types.StateMachine) (ret int) 36 | 37 | -------------------------------------------------------------------------------- /internal/native/neon/validate_utf8_fast_arm64.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package neon 20 | 21 | //go:nosplit 22 | func validate_utf8_fast(s *string) (ret int) { 23 | return __validate_utf8_fast(s) 24 | } 25 | 26 | //go:nosplit 27 | //go:noescape 28 | //goland:noinspection GoUnusedParameter 29 | func __validate_utf8_fast(s *string) (ret int) 30 | -------------------------------------------------------------------------------- /internal/native/neon/validate_utf8_fast_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __validate_utf8_fast_entry__() uintptr 10 | 11 | var ( 12 | _subr__validate_utf8_fast uintptr = __validate_utf8_fast_entry__() + 0 13 | ) 14 | 15 | const ( 16 | _stack__validate_utf8_fast = 48 17 | ) 18 | 19 | var ( 20 | _ = _subr__validate_utf8_fast 21 | ) 22 | 23 | const ( 24 | _ = _stack__validate_utf8_fast 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/validate_utf8_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __validate_utf8_entry__() uintptr 10 | 11 | var ( 12 | _subr__validate_utf8 uintptr = __validate_utf8_entry__() + 0 13 | ) 14 | 15 | const ( 16 | _stack__validate_utf8 = 64 17 | ) 18 | 19 | var ( 20 | _ = _subr__validate_utf8 21 | ) 22 | 23 | const ( 24 | _ = _stack__validate_utf8 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/value_arm64.go: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2021 ByteDance Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package neon 19 | 20 | import ( 21 | `unsafe` 22 | `github.com/bytedance/sonic/internal/native/types` 23 | ) 24 | 25 | //go:nosplit 26 | func value(s unsafe.Pointer, n int, p int, v *types.JsonState, flags uint64) (ret int) { 27 | return __value(s, n, p, v, flags) 28 | } 29 | 30 | //go:nosplit 31 | //go:noescape 32 | //goland:noinspection GoUnusedParameter 33 | func __value(s unsafe.Pointer, n int, p int, v *types.JsonState, flags uint64) (ret int) 34 | 35 | -------------------------------------------------------------------------------- /internal/native/neon/value_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __value_entry__() uintptr 10 | 11 | var ( 12 | _subr__value uintptr = __value_entry__() + 32 13 | ) 14 | 15 | const ( 16 | _stack__value = 112 17 | ) 18 | 19 | var ( 20 | _ = _subr__value 21 | ) 22 | 23 | const ( 24 | _ = _stack__value 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/vnumber_arm64.go: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2021 ByteDance Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package neon 19 | 20 | import ( 21 | `github.com/bytedance/sonic/internal/native/types` 22 | ) 23 | 24 | //go:nosplit 25 | func vnumber(s *string, p *int, v *types.JsonState) { 26 | __vnumber(s, p, v) 27 | } 28 | 29 | //go:nosplit 30 | //go:noescape 31 | //goland:noinspection GoUnusedParameter 32 | func __vnumber(s *string, p *int, v *types.JsonState) 33 | 34 | 35 | -------------------------------------------------------------------------------- /internal/native/neon/vnumber_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __vnumber_entry__() uintptr 10 | 11 | var ( 12 | _subr__vnumber uintptr = __vnumber_entry__() + 0 13 | ) 14 | 15 | const ( 16 | _stack__vnumber = 112 17 | ) 18 | 19 | var ( 20 | _ = _subr__vnumber 21 | ) 22 | 23 | const ( 24 | _ = _stack__vnumber 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/vsigned_arm64.go: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2021 ByteDance Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package neon 19 | 20 | import ( 21 | `github.com/bytedance/sonic/internal/native/types` 22 | ) 23 | 24 | //go:nosplit 25 | func vsigned(s *string, p *int, v *types.JsonState) { 26 | __vsigned(s, p, v) 27 | } 28 | 29 | //go:nosplit 30 | //go:noescape 31 | //goland:noinspection GoUnusedParameter 32 | func __vsigned(s *string, p *int, v *types.JsonState) 33 | -------------------------------------------------------------------------------- /internal/native/neon/vsigned_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __vsigned_entry__() uintptr 10 | 11 | var ( 12 | _subr__vsigned uintptr = __vsigned_entry__() + 0 13 | ) 14 | 15 | const ( 16 | _stack__vsigned = 32 17 | ) 18 | 19 | var ( 20 | _ = _subr__vsigned 21 | ) 22 | 23 | const ( 24 | _ = _stack__vsigned 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/vstring_arm64.go: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2021 ByteDance Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package neon 19 | 20 | import ( 21 | `github.com/bytedance/sonic/internal/native/types` 22 | ) 23 | 24 | //go:nosplit 25 | func vstring(s *string, p *int, v *types.JsonState, flags uint64) { 26 | __vstring(s, p, v, flags) 27 | } 28 | 29 | //go:nosplit 30 | //go:noescape 31 | //goland:noinspection GoUnusedParameter 32 | func __vstring(s *string, p *int, v *types.JsonState, flags uint64) 33 | -------------------------------------------------------------------------------- /internal/native/neon/vstring_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __vstring_entry__() uintptr 10 | 11 | var ( 12 | _subr__vstring uintptr = __vstring_entry__() + 32 13 | ) 14 | 15 | const ( 16 | _stack__vstring = 48 17 | ) 18 | 19 | var ( 20 | _ = _subr__vstring 21 | ) 22 | 23 | const ( 24 | _ = _stack__vstring 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/neon/vunsigned_arm64.go: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2021 ByteDance Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package neon 19 | 20 | import ( 21 | `github.com/bytedance/sonic/internal/native/types` 22 | ) 23 | 24 | //go:nosplit 25 | func vunsigned(s *string, p *int, v *types.JsonState) { 26 | __vunsigned(s, p, v) 27 | } 28 | 29 | //go:nosplit 30 | //go:noescape 31 | //goland:noinspection GoUnusedParameter 32 | func __vunsigned(s *string, p *int, v *types.JsonState) 33 | -------------------------------------------------------------------------------- /internal/native/neon/vunsigned_subr_arm64.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package neon 5 | 6 | //go:nosplit 7 | //go:noescape 8 | //goland:noinspection ALL 9 | func __vunsigned_entry__() uintptr 10 | 11 | var ( 12 | _subr__vunsigned uintptr = __vunsigned_entry__() + 0 13 | ) 14 | 15 | const ( 16 | _stack__vunsigned = 32 17 | ) 18 | 19 | var ( 20 | _ = _subr__vunsigned 21 | ) 22 | 23 | const ( 24 | _ = _stack__vunsigned 25 | ) 26 | -------------------------------------------------------------------------------- /internal/native/parse_with_padding.tmpl: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | // Code generated by Makefile, DO NOT EDIT. 4 | 5 | /* 6 | * Copyright 2021 ByteDance Inc. 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package {{PACKAGE}} 22 | 23 | import ( 24 | `unsafe` 25 | 26 | `github.com/bytedance/sonic/internal/rt` 27 | ) 28 | 29 | var F_parse_with_padding func(parser unsafe.Pointer) (ret int) 30 | 31 | var S_parse_with_padding uintptr 32 | 33 | //go:nosplit 34 | func parse_with_padding(parser unsafe.Pointer) (ret int) { 35 | return F_parse_with_padding(rt.NoEscape(parser)) 36 | } 37 | -------------------------------------------------------------------------------- /internal/native/skip_number.tmpl: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License ); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package {{PACKAGE}} 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_skip_number func(s unsafe.Pointer, p unsafe.Pointer) (ret int) 28 | 29 | var S_skip_number uintptr 30 | 31 | //go:nosplit 32 | func skip_number(s *string, p *int) (ret int) { 33 | return F_skip_number(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p))) 34 | } 35 | -------------------------------------------------------------------------------- /internal/native/skip_one_fast.tmpl: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package {{PACKAGE}} 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_skip_one_fast func(s unsafe.Pointer, p unsafe.Pointer) (ret int) 28 | 29 | var S_skip_one_fast uintptr 30 | 31 | //go:nosplit 32 | func skip_one_fast(s *string, p *int) (ret int) { 33 | return F_skip_one_fast(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p))) 34 | } 35 | 36 | -------------------------------------------------------------------------------- /internal/native/sse/f32toa.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package sse 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_f32toa func(out unsafe.Pointer, val float32) (ret int) 28 | 29 | var S_f32toa uintptr 30 | 31 | //go:nosplit 32 | func f32toa(out *byte, val float32) (ret int) { 33 | return F_f32toa(rt.NoEscape(unsafe.Pointer(out)), val) 34 | } 35 | 36 | -------------------------------------------------------------------------------- /internal/native/sse/f32toa_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__f32toa = 16 12 | ) 13 | 14 | const ( 15 | _stack__f32toa = 64 16 | ) 17 | 18 | const ( 19 | _size__f32toa = 3696 20 | ) 21 | 22 | var ( 23 | _pcsp__f32toa = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0xe3a, 64}, 32 | {0xe3b, 48}, 33 | {0xe3d, 40}, 34 | {0xe3f, 32}, 35 | {0xe41, 24}, 36 | {0xe43, 16}, 37 | {0xe44, 8}, 38 | {0xe45, 0}, 39 | {0xe70, 64}, 40 | } 41 | ) 42 | 43 | var _cfunc_f32toa = []loader.CFunc{ 44 | {"_f32toa_entry", 0, _entry__f32toa, 0, nil}, 45 | {"_f32toa", _entry__f32toa, _size__f32toa, _stack__f32toa, _pcsp__f32toa}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/sse/f64toa.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package sse 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_f64toa func(out unsafe.Pointer, val float64) (ret int) 28 | 29 | var S_f64toa uintptr 30 | 31 | //go:nosplit 32 | func f64toa(out *byte, val float64) (ret int) { 33 | return F_f64toa((rt.NoEscape(unsafe.Pointer(out))), val) 34 | } 35 | 36 | -------------------------------------------------------------------------------- /internal/native/sse/f64toa_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__f64toa = 16 12 | ) 13 | 14 | const ( 15 | _stack__f64toa = 72 16 | ) 17 | 18 | const ( 19 | _size__f64toa = 4992 20 | ) 21 | 22 | var ( 23 | _pcsp__f64toa = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0x131d, 72}, 32 | {0x131e, 48}, 33 | {0x1320, 40}, 34 | {0x1322, 32}, 35 | {0x1324, 24}, 36 | {0x1326, 16}, 37 | {0x1327, 8}, 38 | {0x1328, 0}, 39 | {0x1380, 72}, 40 | } 41 | ) 42 | 43 | var _cfunc_f64toa = []loader.CFunc{ 44 | {"_f64toa_entry", 0, _entry__f64toa, 0, nil}, 45 | {"_f64toa", _entry__f64toa, _size__f64toa, _stack__f64toa, _pcsp__f64toa}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/sse/get_by_path_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__get_by_path = 240 12 | ) 13 | 14 | const ( 15 | _stack__get_by_path = 216 16 | ) 17 | 18 | const ( 19 | _size__get_by_path = 21416 20 | ) 21 | 22 | var ( 23 | _pcsp__get_by_path = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x14, 48}, 31 | {0x4568, 216}, 32 | {0x4569, 48}, 33 | {0x456b, 40}, 34 | {0x456d, 32}, 35 | {0x456f, 24}, 36 | {0x4571, 16}, 37 | {0x4572, 8}, 38 | {0x4573, 0}, 39 | {0x53a8, 216}, 40 | } 41 | ) 42 | 43 | var _cfunc_get_by_path = []loader.CFunc{ 44 | {"_get_by_path_entry", 0, _entry__get_by_path, 0, nil}, 45 | {"_get_by_path", _entry__get_by_path, _size__get_by_path, _stack__get_by_path, _pcsp__get_by_path}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/sse/html_escape.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package sse 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_html_escape func(sp unsafe.Pointer, nb int, dp unsafe.Pointer, dn unsafe.Pointer) (ret int) 28 | 29 | var S_html_escape uintptr 30 | 31 | //go:nosplit 32 | func html_escape(sp unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int) (ret int) { 33 | return F_html_escape(rt.NoEscape(sp), nb, dp, rt.NoEscape(unsafe.Pointer(dn))) 34 | } 35 | -------------------------------------------------------------------------------- /internal/native/sse/html_escape_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__html_escape = 64 12 | ) 13 | 14 | const ( 15 | _stack__html_escape = 64 16 | ) 17 | 18 | const ( 19 | _size__html_escape = 1296 20 | ) 21 | 22 | var ( 23 | _pcsp__html_escape = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0x505, 64}, 32 | {0x506, 48}, 33 | {0x508, 40}, 34 | {0x50a, 32}, 35 | {0x50c, 24}, 36 | {0x50e, 16}, 37 | {0x50f, 8}, 38 | {0x510, 0}, 39 | } 40 | ) 41 | 42 | var _cfunc_html_escape = []loader.CFunc{ 43 | {"_html_escape_entry", 0, _entry__html_escape, 0, nil}, 44 | {"_html_escape", _entry__html_escape, _size__html_escape, _stack__html_escape, _pcsp__html_escape}, 45 | } 46 | -------------------------------------------------------------------------------- /internal/native/sse/i64toa.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package sse 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_i64toa func(out unsafe.Pointer, val int64) (ret int) 28 | 29 | var S_i64toa uintptr 30 | 31 | //go:nosplit 32 | func i64toa(out *byte, val int64) (ret int) { 33 | return F_i64toa(rt.NoEscape(unsafe.Pointer(out)), val) 34 | } 35 | 36 | -------------------------------------------------------------------------------- /internal/native/sse/i64toa_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__i64toa = 80 12 | ) 13 | 14 | const ( 15 | _stack__i64toa = 8 16 | ) 17 | 18 | const ( 19 | _size__i64toa = 2320 20 | ) 21 | 22 | var ( 23 | _pcsp__i64toa = [][2]uint32{ 24 | {0x1, 0}, 25 | {0xae, 8}, 26 | {0xaf, 0}, 27 | {0x201, 8}, 28 | {0x202, 0}, 29 | {0x287, 8}, 30 | {0x288, 0}, 31 | {0x464, 8}, 32 | {0x465, 0}, 33 | {0x4f0, 8}, 34 | {0x4f1, 0}, 35 | {0x62c, 8}, 36 | {0x62d, 0}, 37 | {0x797, 8}, 38 | {0x798, 0}, 39 | {0x909, 8}, 40 | {0x910, 0}, 41 | } 42 | ) 43 | 44 | var _cfunc_i64toa = []loader.CFunc{ 45 | {"_i64toa_entry", 0, _entry__i64toa, 0, nil}, 46 | {"_i64toa", _entry__i64toa, _size__i64toa, _stack__i64toa, _pcsp__i64toa}, 47 | } 48 | -------------------------------------------------------------------------------- /internal/native/sse/lookup_small_key_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__lookup_small_key = 48 12 | ) 13 | 14 | const ( 15 | _stack__lookup_small_key = 88 16 | ) 17 | 18 | const ( 19 | _size__lookup_small_key = 908 20 | ) 21 | 22 | var ( 23 | _pcsp__lookup_small_key = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0x362, 88}, 32 | {0x363, 48}, 33 | {0x365, 40}, 34 | {0x367, 32}, 35 | {0x369, 24}, 36 | {0x36b, 16}, 37 | {0x36c, 8}, 38 | {0x36d, 0}, 39 | {0x38c, 88}, 40 | } 41 | ) 42 | 43 | var _cfunc_lookup_small_key = []loader.CFunc{ 44 | {"_lookup_small_key_entry", 0, _entry__lookup_small_key, 0, nil}, 45 | {"_lookup_small_key", _entry__lookup_small_key, _size__lookup_small_key, _stack__lookup_small_key, _pcsp__lookup_small_key}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/sse/lspace.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package sse 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_lspace func(sp unsafe.Pointer, nb int, off int) (ret int) 28 | 29 | var S_lspace uintptr 30 | 31 | //go:nosplit 32 | func lspace(sp *byte, nb int, off int) (ret int) { 33 | return F_lspace(rt.NoEscape(unsafe.Pointer(sp)), nb, off) 34 | } 35 | 36 | -------------------------------------------------------------------------------- /internal/native/sse/lspace_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__lspace = 0 12 | ) 13 | 14 | const ( 15 | _stack__lspace = 8 16 | ) 17 | 18 | const ( 19 | _size__lspace = 87 20 | ) 21 | 22 | var ( 23 | _pcsp__lspace = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x56, 8}, 26 | {0x57, 0}, 27 | } 28 | ) 29 | 30 | var _cfunc_lspace = []loader.CFunc{ 31 | {"_lspace_entry", 0, _entry__lspace, 0, nil}, 32 | {"_lspace", _entry__lspace, _size__lspace, _stack__lspace, _pcsp__lspace}, 33 | } 34 | -------------------------------------------------------------------------------- /internal/native/sse/parse_with_padding.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | // Code generated by Makefile, DO NOT EDIT. 4 | 5 | /* 6 | * Copyright 2021 ByteDance Inc. 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package sse 22 | 23 | import ( 24 | `unsafe` 25 | 26 | `github.com/bytedance/sonic/internal/rt` 27 | ) 28 | 29 | var F_parse_with_padding func(parser unsafe.Pointer) (ret int) 30 | 31 | var S_parse_with_padding uintptr 32 | 33 | //go:nosplit 34 | func parse_with_padding(parser unsafe.Pointer) (ret int) { 35 | return F_parse_with_padding(rt.NoEscape(parser)) 36 | } 37 | -------------------------------------------------------------------------------- /internal/native/sse/parse_with_padding_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__parse_with_padding = 336 12 | ) 13 | 14 | const ( 15 | _stack__parse_with_padding = 192 16 | ) 17 | 18 | const ( 19 | _size__parse_with_padding = 47760 20 | ) 21 | 22 | var ( 23 | _pcsp__parse_with_padding = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x14, 48}, 31 | {0xb0c, 192}, 32 | {0xb0d, 48}, 33 | {0xb0f, 40}, 34 | {0xb11, 32}, 35 | {0xb13, 24}, 36 | {0xb15, 16}, 37 | {0xb16, 8}, 38 | {0xb17, 0}, 39 | {0xba90, 192}, 40 | } 41 | ) 42 | 43 | var _cfunc_parse_with_padding = []loader.CFunc{ 44 | {"_parse_with_padding_entry", 0, _entry__parse_with_padding, 0, nil}, 45 | {"_parse_with_padding", _entry__parse_with_padding, _size__parse_with_padding, _stack__parse_with_padding, _pcsp__parse_with_padding}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/sse/quote_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__quote = 48 12 | ) 13 | 14 | const ( 15 | _stack__quote = 80 16 | ) 17 | 18 | const ( 19 | _size__quote = 1760 20 | ) 21 | 22 | var ( 23 | _pcsp__quote = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0x6a9, 80}, 32 | {0x6aa, 48}, 33 | {0x6ac, 40}, 34 | {0x6ae, 32}, 35 | {0x6b0, 24}, 36 | {0x6b2, 16}, 37 | {0x6b3, 8}, 38 | {0x6b4, 0}, 39 | {0x6e0, 80}, 40 | } 41 | ) 42 | 43 | var _cfunc_quote = []loader.CFunc{ 44 | {"_quote_entry", 0, _entry__quote, 0, nil}, 45 | {"_quote", _entry__quote, _size__quote, _stack__quote, _pcsp__quote}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/sse/skip_array_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__skip_array = 256 12 | ) 13 | 14 | const ( 15 | _stack__skip_array = 184 16 | ) 17 | 18 | const ( 19 | _size__skip_array = 15328 20 | ) 21 | 22 | var ( 23 | _pcsp__skip_array = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x14, 48}, 31 | {0x394e, 184}, 32 | {0x394f, 48}, 33 | {0x3951, 40}, 34 | {0x3953, 32}, 35 | {0x3955, 24}, 36 | {0x3957, 16}, 37 | {0x3958, 8}, 38 | {0x3959, 0}, 39 | {0x3be0, 184}, 40 | } 41 | ) 42 | 43 | var _cfunc_skip_array = []loader.CFunc{ 44 | {"_skip_array_entry", 0, _entry__skip_array, 0, nil}, 45 | {"_skip_array", _entry__skip_array, _size__skip_array, _stack__skip_array, _pcsp__skip_array}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/sse/skip_number.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the License ); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an AS IS BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package sse 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_skip_number func(s unsafe.Pointer, p unsafe.Pointer) (ret int) 28 | 29 | var S_skip_number uintptr 30 | 31 | //go:nosplit 32 | func skip_number(s *string, p *int) (ret int) { 33 | return F_skip_number(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p))) 34 | } 35 | -------------------------------------------------------------------------------- /internal/native/sse/skip_number_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__skip_number = 112 12 | ) 13 | 14 | const ( 15 | _stack__skip_number = 72 16 | ) 17 | 18 | const ( 19 | _size__skip_number = 1060 20 | ) 21 | 22 | var ( 23 | _pcsp__skip_number = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0x373, 72}, 32 | {0x374, 48}, 33 | {0x376, 40}, 34 | {0x378, 32}, 35 | {0x37a, 24}, 36 | {0x37c, 16}, 37 | {0x37d, 8}, 38 | {0x37e, 0}, 39 | {0x424, 72}, 40 | } 41 | ) 42 | 43 | var _cfunc_skip_number = []loader.CFunc{ 44 | {"_skip_number_entry", 0, _entry__skip_number, 0, nil}, 45 | {"_skip_number", _entry__skip_number, _size__skip_number, _stack__skip_number, _pcsp__skip_number}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/sse/skip_object_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__skip_object = 256 12 | ) 13 | 14 | const ( 15 | _stack__skip_object = 184 16 | ) 17 | 18 | const ( 19 | _size__skip_object = 15328 20 | ) 21 | 22 | var ( 23 | _pcsp__skip_object = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x14, 48}, 31 | {0x394e, 184}, 32 | {0x394f, 48}, 33 | {0x3951, 40}, 34 | {0x3953, 32}, 35 | {0x3955, 24}, 36 | {0x3957, 16}, 37 | {0x3958, 8}, 38 | {0x3959, 0}, 39 | {0x3be0, 184}, 40 | } 41 | ) 42 | 43 | var _cfunc_skip_object = []loader.CFunc{ 44 | {"_skip_object_entry", 0, _entry__skip_object, 0, nil}, 45 | {"_skip_object", _entry__skip_object, _size__skip_object, _stack__skip_object, _pcsp__skip_object}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/sse/skip_one_fast.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package sse 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_skip_one_fast func(s unsafe.Pointer, p unsafe.Pointer) (ret int) 28 | 29 | var S_skip_one_fast uintptr 30 | 31 | //go:nosplit 32 | func skip_one_fast(s *string, p *int) (ret int) { 33 | return F_skip_one_fast(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p))) 34 | } 35 | 36 | -------------------------------------------------------------------------------- /internal/native/sse/skip_one_fast_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__skip_one_fast = 128 12 | ) 13 | 14 | const ( 15 | _stack__skip_one_fast = 136 16 | ) 17 | 18 | const ( 19 | _size__skip_one_fast = 3348 20 | ) 21 | 22 | var ( 23 | _pcsp__skip_one_fast = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0x25c, 136}, 32 | {0x25d, 48}, 33 | {0x25f, 40}, 34 | {0x261, 32}, 35 | {0x263, 24}, 36 | {0x265, 16}, 37 | {0x266, 8}, 38 | {0x267, 0}, 39 | {0xd14, 136}, 40 | } 41 | ) 42 | 43 | var _cfunc_skip_one_fast = []loader.CFunc{ 44 | {"_skip_one_fast_entry", 0, _entry__skip_one_fast, 0, nil}, 45 | {"_skip_one_fast", _entry__skip_one_fast, _size__skip_one_fast, _stack__skip_one_fast, _pcsp__skip_one_fast}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/sse/skip_one_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__skip_one = 256 12 | ) 13 | 14 | const ( 15 | _stack__skip_one = 232 16 | ) 17 | 18 | const ( 19 | _size__skip_one = 13880 20 | ) 21 | 22 | var ( 23 | _pcsp__skip_one = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x14, 48}, 31 | {0x3330, 232}, 32 | {0x3331, 48}, 33 | {0x3333, 40}, 34 | {0x3335, 32}, 35 | {0x3337, 24}, 36 | {0x3339, 16}, 37 | {0x333a, 8}, 38 | {0x333b, 0}, 39 | {0x3638, 232}, 40 | } 41 | ) 42 | 43 | var _cfunc_skip_one = []loader.CFunc{ 44 | {"_skip_one_entry", 0, _entry__skip_one, 0, nil}, 45 | {"_skip_one", _entry__skip_one, _size__skip_one, _stack__skip_one, _pcsp__skip_one}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/sse/u64toa.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package sse 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_u64toa func(out unsafe.Pointer, val uint64) (ret int) 28 | 29 | var S_u64toa uintptr 30 | 31 | //go:nosplit 32 | func u64toa(out *byte, val uint64) (ret int) { 33 | return F_u64toa(rt.NoEscape(unsafe.Pointer(out)), val) 34 | } 35 | -------------------------------------------------------------------------------- /internal/native/sse/u64toa_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__u64toa = 80 12 | ) 13 | 14 | const ( 15 | _stack__u64toa = 8 16 | ) 17 | 18 | const ( 19 | _size__u64toa = 1232 20 | ) 21 | 22 | var ( 23 | _pcsp__u64toa = [][2]uint32{ 24 | {0x1, 0}, 25 | {0xa5, 8}, 26 | {0xa6, 0}, 27 | {0x1cf, 8}, 28 | {0x1d0, 0}, 29 | {0x307, 8}, 30 | {0x308, 0}, 31 | {0x4cf, 8}, 32 | {0x4d0, 0}, 33 | } 34 | ) 35 | 36 | var _cfunc_u64toa = []loader.CFunc{ 37 | {"_u64toa_entry", 0, _entry__u64toa, 0, nil}, 38 | {"_u64toa", _entry__u64toa, _size__u64toa, _stack__u64toa, _pcsp__u64toa}, 39 | } 40 | -------------------------------------------------------------------------------- /internal/native/sse/unquote_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__unquote = 16 12 | ) 13 | 14 | const ( 15 | _stack__unquote = 80 16 | ) 17 | 18 | const ( 19 | _size__unquote = 2096 20 | ) 21 | 22 | var ( 23 | _pcsp__unquote = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0x541, 80}, 32 | {0x542, 48}, 33 | {0x544, 40}, 34 | {0x546, 32}, 35 | {0x548, 24}, 36 | {0x54a, 16}, 37 | {0x54b, 8}, 38 | {0x54c, 0}, 39 | {0x830, 80}, 40 | } 41 | ) 42 | 43 | var _cfunc_unquote = []loader.CFunc{ 44 | {"_unquote_entry", 0, _entry__unquote, 0, nil}, 45 | {"_unquote", _entry__unquote, _size__unquote, _stack__unquote, _pcsp__unquote}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/sse/validate_one_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__validate_one = 256 12 | ) 13 | 14 | const ( 15 | _stack__validate_one = 184 16 | ) 17 | 18 | const ( 19 | _size__validate_one = 15328 20 | ) 21 | 22 | var ( 23 | _pcsp__validate_one = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x14, 48}, 31 | {0x394e, 184}, 32 | {0x394f, 48}, 33 | {0x3951, 40}, 34 | {0x3953, 32}, 35 | {0x3955, 24}, 36 | {0x3957, 16}, 37 | {0x3958, 8}, 38 | {0x3959, 0}, 39 | {0x3be0, 184}, 40 | } 41 | ) 42 | 43 | var _cfunc_validate_one = []loader.CFunc{ 44 | {"_validate_one_entry", 0, _entry__validate_one, 0, nil}, 45 | {"_validate_one", _entry__validate_one, _size__validate_one, _stack__validate_one, _pcsp__validate_one}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/sse/validate_utf8_fast.go: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package sse 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_validate_utf8_fast func(s unsafe.Pointer) (ret int) 28 | 29 | var S_validate_utf8_fast uintptr 30 | 31 | //go:nosplit 32 | func validate_utf8_fast(s *string) (ret int) { 33 | return F_validate_utf8_fast(rt.NoEscape(unsafe.Pointer(s))) 34 | } 35 | -------------------------------------------------------------------------------- /internal/native/sse/validate_utf8_fast_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__validate_utf8_fast = 0 12 | ) 13 | 14 | const ( 15 | _stack__validate_utf8_fast = 24 16 | ) 17 | 18 | const ( 19 | _size__validate_utf8_fast = 536 20 | ) 21 | 22 | var ( 23 | _pcsp__validate_utf8_fast = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x5, 8}, 26 | {0x6, 16}, 27 | {0xfb, 24}, 28 | {0xfc, 16}, 29 | {0xfd, 8}, 30 | {0xfe, 0}, 31 | {0x213, 24}, 32 | {0x214, 16}, 33 | {0x215, 8}, 34 | {0x218, 0}, 35 | } 36 | ) 37 | 38 | var _cfunc_validate_utf8_fast = []loader.CFunc{ 39 | {"_validate_utf8_fast_entry", 0, _entry__validate_utf8_fast, 0, nil}, 40 | {"_validate_utf8_fast", _entry__validate_utf8_fast, _size__validate_utf8_fast, _stack__validate_utf8_fast, _pcsp__validate_utf8_fast}, 41 | } 42 | -------------------------------------------------------------------------------- /internal/native/sse/validate_utf8_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__validate_utf8 = 0 12 | ) 13 | 14 | const ( 15 | _stack__validate_utf8 = 48 16 | ) 17 | 18 | const ( 19 | _size__validate_utf8 = 684 20 | ) 21 | 22 | var ( 23 | _pcsp__validate_utf8 = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xb, 32}, 29 | {0xc, 40}, 30 | {0x283, 48}, 31 | {0x284, 40}, 32 | {0x286, 32}, 33 | {0x288, 24}, 34 | {0x28a, 16}, 35 | {0x28b, 8}, 36 | {0x28c, 0}, 37 | {0x2ac, 48}, 38 | } 39 | ) 40 | 41 | var _cfunc_validate_utf8 = []loader.CFunc{ 42 | {"_validate_utf8_entry", 0, _entry__validate_utf8, 0, nil}, 43 | {"_validate_utf8", _entry__validate_utf8, _size__validate_utf8, _stack__validate_utf8, _pcsp__validate_utf8}, 44 | } 45 | -------------------------------------------------------------------------------- /internal/native/sse/value_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__value = 208 12 | ) 13 | 14 | const ( 15 | _stack__value = 128 16 | ) 17 | 18 | const ( 19 | _size__value = 11788 20 | ) 21 | 22 | var ( 23 | _pcsp__value = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0x20a, 128}, 32 | {0x20b, 48}, 33 | {0x20d, 40}, 34 | {0x20f, 32}, 35 | {0x211, 24}, 36 | {0x213, 16}, 37 | {0x214, 8}, 38 | {0x215, 0}, 39 | {0x2e0c, 128}, 40 | } 41 | ) 42 | 43 | var _cfunc_value = []loader.CFunc{ 44 | {"_value_entry", 0, _entry__value, 0, nil}, 45 | {"_value", _entry__value, _size__value, _stack__value, _pcsp__value}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/sse/vnumber.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package sse 18 | 19 | import ( 20 | `unsafe` 21 | 22 | `github.com/bytedance/sonic/internal/native/types` 23 | `github.com/bytedance/sonic/internal/rt` 24 | ) 25 | 26 | var F_vnumber func(s unsafe.Pointer, p unsafe.Pointer, v unsafe.Pointer) 27 | 28 | var S_vnumber uintptr 29 | 30 | //go:nosplit 31 | func vnumber(s *string, p *int, v *types.JsonState) { 32 | F_vnumber(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p)), rt.NoEscape(unsafe.Pointer(v))) 33 | } 34 | -------------------------------------------------------------------------------- /internal/native/sse/vnumber_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__vnumber = 48 12 | ) 13 | 14 | const ( 15 | _stack__vnumber = 136 16 | ) 17 | 18 | const ( 19 | _size__vnumber = 7880 20 | ) 21 | 22 | var ( 23 | _pcsp__vnumber = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0x1ebb, 136}, 32 | {0x1ebc, 48}, 33 | {0x1ebe, 40}, 34 | {0x1ec0, 32}, 35 | {0x1ec2, 24}, 36 | {0x1ec4, 16}, 37 | {0x1ec5, 8}, 38 | {0x1ec8, 0}, 39 | } 40 | ) 41 | 42 | var _cfunc_vnumber = []loader.CFunc{ 43 | {"_vnumber_entry", 0, _entry__vnumber, 0, nil}, 44 | {"_vnumber", _entry__vnumber, _size__vnumber, _stack__vnumber, _pcsp__vnumber}, 45 | } 46 | -------------------------------------------------------------------------------- /internal/native/sse/vsigned.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package sse 18 | 19 | import ( 20 | `unsafe` 21 | 22 | `github.com/bytedance/sonic/internal/native/types` 23 | `github.com/bytedance/sonic/internal/rt` 24 | ) 25 | 26 | var F_vsigned func(s unsafe.Pointer, p unsafe.Pointer, v unsafe.Pointer) 27 | 28 | var S_vsigned uintptr 29 | 30 | //go:nosplit 31 | func vsigned(s *string, p *int, v *types.JsonState) { 32 | F_vsigned(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p)), rt.NoEscape(unsafe.Pointer(v))) 33 | } 34 | -------------------------------------------------------------------------------- /internal/native/sse/vsigned_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__vsigned = 0 12 | ) 13 | 14 | const ( 15 | _stack__vsigned = 16 16 | ) 17 | 18 | const ( 19 | _size__vsigned = 356 20 | ) 21 | 22 | var ( 23 | _pcsp__vsigned = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x5, 8}, 26 | {0x70, 16}, 27 | {0x71, 8}, 28 | {0x72, 0}, 29 | {0x7d, 16}, 30 | {0x7e, 8}, 31 | {0x7f, 0}, 32 | {0x117, 16}, 33 | {0x118, 8}, 34 | {0x119, 0}, 35 | {0x11d, 16}, 36 | {0x11e, 8}, 37 | {0x11f, 0}, 38 | {0x155, 16}, 39 | {0x156, 8}, 40 | {0x157, 0}, 41 | {0x162, 16}, 42 | {0x163, 8}, 43 | {0x164, 0}, 44 | } 45 | ) 46 | 47 | var _cfunc_vsigned = []loader.CFunc{ 48 | {"_vsigned_entry", 0, _entry__vsigned, 0, nil}, 49 | {"_vsigned", _entry__vsigned, _size__vsigned, _stack__vsigned, _pcsp__vsigned}, 50 | } 51 | -------------------------------------------------------------------------------- /internal/native/sse/vstring_subr.go: -------------------------------------------------------------------------------- 1 | // +build !noasm !appengine 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | package sse 5 | 6 | import ( 7 | `github.com/bytedance/sonic/loader` 8 | ) 9 | 10 | const ( 11 | _entry__vstring = 48 12 | ) 13 | 14 | const ( 15 | _stack__vstring = 104 16 | ) 17 | 18 | const ( 19 | _size__vstring = 2396 20 | ) 21 | 22 | var ( 23 | _pcsp__vstring = [][2]uint32{ 24 | {0x1, 0}, 25 | {0x6, 8}, 26 | {0x8, 16}, 27 | {0xa, 24}, 28 | {0xc, 32}, 29 | {0xd, 40}, 30 | {0x11, 48}, 31 | {0x8b1, 104}, 32 | {0x8b2, 48}, 33 | {0x8b4, 40}, 34 | {0x8b6, 32}, 35 | {0x8b8, 24}, 36 | {0x8ba, 16}, 37 | {0x8bb, 8}, 38 | {0x8bc, 0}, 39 | {0x95c, 104}, 40 | } 41 | ) 42 | 43 | var _cfunc_vstring = []loader.CFunc{ 44 | {"_vstring_entry", 0, _entry__vstring, 0, nil}, 45 | {"_vstring", _entry__vstring, _size__vstring, _stack__vstring, _pcsp__vstring}, 46 | } 47 | -------------------------------------------------------------------------------- /internal/native/sse/vunsigned.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package sse 18 | 19 | import ( 20 | `unsafe` 21 | 22 | `github.com/bytedance/sonic/internal/native/types` 23 | `github.com/bytedance/sonic/internal/rt` 24 | ) 25 | 26 | var F_vunsigned func(s unsafe.Pointer, p unsafe.Pointer, v unsafe.Pointer) 27 | 28 | var S_vunsigned uintptr 29 | 30 | //go:nosplit 31 | func vunsigned(s *string, p *int, v *types.JsonState) { 32 | F_vunsigned(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p)), rt.NoEscape(unsafe.Pointer(v))) 33 | } 34 | -------------------------------------------------------------------------------- /internal/native/u64toa.tmpl: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package {{PACKAGE}} 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_u64toa func(out unsafe.Pointer, val uint64) (ret int) 28 | 29 | var S_u64toa uintptr 30 | 31 | //go:nosplit 32 | func u64toa(out *byte, val uint64) (ret int) { 33 | return F_u64toa(rt.NoEscape(unsafe.Pointer(out)), val) 34 | } 35 | -------------------------------------------------------------------------------- /internal/native/validate_utf8_fast.tmpl: -------------------------------------------------------------------------------- 1 | // Code generated by Makefile, DO NOT EDIT. 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package {{PACKAGE}} 20 | 21 | import ( 22 | `unsafe` 23 | 24 | `github.com/bytedance/sonic/internal/rt` 25 | ) 26 | 27 | var F_validate_utf8_fast func(s unsafe.Pointer) (ret int) 28 | 29 | var S_validate_utf8_fast uintptr 30 | 31 | //go:nosplit 32 | func validate_utf8_fast(s *string) (ret int) { 33 | return F_validate_utf8_fast(rt.NoEscape(unsafe.Pointer(s))) 34 | } 35 | -------------------------------------------------------------------------------- /internal/native/vnumber.tmpl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package {{PACKAGE}} 18 | 19 | import ( 20 | `unsafe` 21 | 22 | `github.com/bytedance/sonic/internal/native/types` 23 | `github.com/bytedance/sonic/internal/rt` 24 | ) 25 | 26 | var F_vnumber func(s unsafe.Pointer, p unsafe.Pointer, v unsafe.Pointer) 27 | 28 | var S_vnumber uintptr 29 | 30 | //go:nosplit 31 | func vnumber(s *string, p *int, v *types.JsonState) { 32 | F_vnumber(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p)), rt.NoEscape(unsafe.Pointer(v))) 33 | } 34 | -------------------------------------------------------------------------------- /internal/native/vsigned.tmpl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package {{PACKAGE}} 18 | 19 | import ( 20 | `unsafe` 21 | 22 | `github.com/bytedance/sonic/internal/native/types` 23 | `github.com/bytedance/sonic/internal/rt` 24 | ) 25 | 26 | var F_vsigned func(s unsafe.Pointer, p unsafe.Pointer, v unsafe.Pointer) 27 | 28 | var S_vsigned uintptr 29 | 30 | //go:nosplit 31 | func vsigned(s *string, p *int, v *types.JsonState) { 32 | F_vsigned(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p)), rt.NoEscape(unsafe.Pointer(v))) 33 | } 34 | -------------------------------------------------------------------------------- /internal/native/vunsigned.tmpl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package {{PACKAGE}} 18 | 19 | import ( 20 | `unsafe` 21 | 22 | `github.com/bytedance/sonic/internal/native/types` 23 | `github.com/bytedance/sonic/internal/rt` 24 | ) 25 | 26 | var F_vunsigned func(s unsafe.Pointer, p unsafe.Pointer, v unsafe.Pointer) 27 | 28 | var S_vunsigned uintptr 29 | 30 | //go:nosplit 31 | func vunsigned(s *string, p *int, v *types.JsonState) { 32 | F_vunsigned(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p)), rt.NoEscape(unsafe.Pointer(v))) 33 | } 34 | -------------------------------------------------------------------------------- /internal/optcaching/asm.s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/sonic/a5ac536f86e855ee984145f7426db6bb7998d858/internal/optcaching/asm.s -------------------------------------------------------------------------------- /internal/resolver/asm.s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/sonic/a5ac536f86e855ee984145f7426db6bb7998d858/internal/resolver/asm.s -------------------------------------------------------------------------------- /internal/rt/asm_amd64.s: -------------------------------------------------------------------------------- 1 | // +build !noasm,amd64 !appengine,amd64 2 | // Code generated by asm2asm, DO NOT EDIT· 3 | 4 | #include "go_asm.h" 5 | #include "funcdata.h" 6 | #include "textflag.h" 7 | 8 | TEXT ·MoreStack(SB), NOSPLIT, $0 - 8 9 | NO_LOCAL_POINTERS 10 | _entry: 11 | MOVQ (TLS), R14 12 | MOVQ size+0(FP), R12 13 | NOTQ R12 14 | LEAQ (SP)(R12*1), R12 15 | CMPQ R12, 16(R14) 16 | JBE _stack_grow 17 | RET 18 | _stack_grow: 19 | CALL runtime·morestack_noctxt<>(SB) 20 | JMP _entry 21 | -------------------------------------------------------------------------------- /internal/rt/asm_compat.s: -------------------------------------------------------------------------------- 1 | // +build !noasm,!amd64 !appengine,!amd64 2 | // Code generated by asm2asm, DO NOT EDIT. 3 | 4 | #include "go_asm.h" 5 | #include "funcdata.h" 6 | #include "textflag.h" 7 | 8 | TEXT ·MoreStack(SB), NOSPLIT, $0 - 8 9 | NO_LOCAL_POINTERS 10 | RET 11 | -------------------------------------------------------------------------------- /internal/rt/assertI2I.go: -------------------------------------------------------------------------------- 1 | // +build go1.17 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package rt 20 | 21 | import ( 22 | _ `unsafe` 23 | ) 24 | 25 | func AssertI2I(t *GoType, i GoIface) (r GoIface) { 26 | inter := IfaceType(t) 27 | tab := i.Itab 28 | if tab == nil { 29 | return 30 | } 31 | if (*GoInterfaceType)(tab.it) != inter { 32 | tab = GetItab(inter, tab.Vt, true) 33 | if tab == nil { 34 | return 35 | } 36 | } 37 | r.Itab = tab 38 | r.Value = i.Value 39 | return 40 | } 41 | 42 | 43 | -------------------------------------------------------------------------------- /internal/rt/base64_compat.go: -------------------------------------------------------------------------------- 1 | // +build !amd64 !go1.17 go1.25 2 | 3 | package rt 4 | 5 | import ( 6 | "encoding/base64" 7 | ) 8 | 9 | func DecodeBase64(raw []byte) ([]byte, error) { 10 | ret := make([]byte, base64.StdEncoding.DecodedLen(len(raw))) 11 | n, err := base64.StdEncoding.Decode(ret, raw) 12 | if err != nil { 13 | return nil, err 14 | } 15 | return ret[:n], nil 16 | } 17 | 18 | func EncodeBase64ToString(src []byte) string { 19 | return base64.StdEncoding.EncodeToString(src) 20 | } 21 | 22 | func EncodeBase64(buf []byte, src []byte) []byte { 23 | if len(src) == 0 { 24 | return append(buf, '"', '"') 25 | } 26 | buf = append(buf, '"') 27 | need := base64.StdEncoding.EncodedLen(len(src)) 28 | if cap(buf) - len(buf) < need { 29 | tmp := make([]byte, len(buf), len(buf) + need*2) 30 | copy(tmp, buf) 31 | buf = tmp 32 | } 33 | base64.StdEncoding.Encode(buf[len(buf):cap(buf)], src) 34 | buf = buf[:len(buf) + need] 35 | buf = append(buf, '"') 36 | return buf 37 | } 38 | -------------------------------------------------------------------------------- /internal/rt/gcwb_legacy.go: -------------------------------------------------------------------------------- 1 | // +build go1.17,!go1.21 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package rt 20 | 21 | import ( 22 | _ `unsafe` 23 | ) 24 | 25 | //go:linkname GcWriteBarrierAX runtime.gcWriteBarrier 26 | func GcWriteBarrierAX() 27 | 28 | //go:linkname RuntimeWriteBarrier runtime.writeBarrier 29 | var RuntimeWriteBarrier uintptr 30 | -------------------------------------------------------------------------------- /internal/rt/growslice_legacy.go: -------------------------------------------------------------------------------- 1 | // +build go1.16,!go1.20 2 | 3 | /* 4 | * Copyright 2021 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package rt 20 | 21 | import ( 22 | _ `unsafe` 23 | ) 24 | 25 | //go:linkname GrowSlice runtime.growslice 26 | //goland:noinspection GoUnusedParameter 27 | func GrowSlice(et *GoType, old GoSlice, cap int) GoSlice 28 | -------------------------------------------------------------------------------- /internal/rt/int48.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package rt 18 | 19 | const ( 20 | MinInt48 int64 = -(1 << 47) 21 | MaxInt48 int64 = +(1 << 47) - 1 22 | ) 23 | 24 | func PackInt(v int) uint64 { 25 | if u := uint64(v); int64(v) < MinInt48 || int64(v) > MaxInt48 { 26 | panic("int48 out of range") 27 | } else { 28 | return ((u >> 63) << 47) | (u & 0x00007fffffffffff) 29 | } 30 | } 31 | 32 | func UnpackInt(v uint64) int { 33 | v &= 0x0000ffffffffffff 34 | v |= (v >> 47) * (0xffff << 48) 35 | return int(v) 36 | } 37 | -------------------------------------------------------------------------------- /internal/rt/map_legacy.go: -------------------------------------------------------------------------------- 1 | // +build !go1.24 2 | 3 | package rt 4 | 5 | import ( 6 | "unsafe" 7 | ) 8 | 9 | type GoMapIterator struct { 10 | K unsafe.Pointer 11 | V unsafe.Pointer 12 | T *GoMapType 13 | H unsafe.Pointer 14 | Buckets unsafe.Pointer 15 | Bptr *unsafe.Pointer 16 | Overflow *[]unsafe.Pointer 17 | OldOverflow *[]unsafe.Pointer 18 | StartBucket uintptr 19 | Offset uint8 20 | Wrapped bool 21 | B uint8 22 | I uint8 23 | Bucket uintptr 24 | CheckBucket uintptr 25 | } 26 | -------------------------------------------------------------------------------- /internal/rt/map_nosiwss_go124.go: -------------------------------------------------------------------------------- 1 | //go:build go1.24 && !go1.25 && !goexperiment.swissmap 2 | // +build go1.24,!go1.25,!goexperiment.swissmap 3 | 4 | package rt 5 | 6 | import ( 7 | "unsafe" 8 | ) 9 | 10 | type GoMapIterator struct { 11 | K unsafe.Pointer 12 | V unsafe.Pointer 13 | T *GoMapType 14 | H unsafe.Pointer 15 | Buckets unsafe.Pointer 16 | Bptr *unsafe.Pointer 17 | Overflow *[]unsafe.Pointer 18 | OldOverflow *[]unsafe.Pointer 19 | StartBucket uintptr 20 | Offset uint8 21 | Wrapped bool 22 | B uint8 23 | I uint8 24 | Bucket uintptr 25 | CheckBucket uintptr 26 | // different from go1.23 27 | ClearSeq uint64 28 | } 29 | -------------------------------------------------------------------------------- /internal/rt/map_siwss_go124.go: -------------------------------------------------------------------------------- 1 | //go:build go1.24 && !go1.25 && goexperiment.swissmap 2 | // +build go1.24,!go1.25,goexperiment.swissmap 3 | 4 | package rt 5 | 6 | import ( 7 | "unsafe" 8 | ) 9 | 10 | type GoMapIterator struct { 11 | K unsafe.Pointer 12 | V unsafe.Pointer 13 | T *GoMapType 14 | It unsafe.Pointer 15 | } 16 | -------------------------------------------------------------------------------- /internal/rt/pool.go: -------------------------------------------------------------------------------- 1 | package rt 2 | 3 | import ( 4 | "unsafe" 5 | ) 6 | 7 | type SlicePool struct { 8 | pool unsafe.Pointer 9 | len int 10 | index int 11 | typ uintptr 12 | } 13 | 14 | func NewPool(typ *GoType, size int) SlicePool { 15 | return SlicePool{pool: newarray(typ, size), len: size, typ: uintptr(unsafe.Pointer(typ))} 16 | } 17 | 18 | func (self *SlicePool) GetSlice(size int) unsafe.Pointer { 19 | // pool is full, fallback to normal alloc 20 | if size > self.Remain() { 21 | return newarray(AsGoType(self.typ), size) 22 | } 23 | 24 | ptr := PtrAdd(self.pool, uintptr(self.index)* AsGoType(self.typ).Size) 25 | self.index += size 26 | return ptr 27 | } 28 | 29 | func (self *SlicePool) Remain() int { 30 | return self.len - self.index 31 | } 32 | -------------------------------------------------------------------------------- /internal/rt/pool_test.go: -------------------------------------------------------------------------------- 1 | package rt 2 | 3 | import ( 4 | "sync" 5 | "testing" 6 | ) 7 | 8 | var poolTest = sync.Pool{ 9 | New: newBytes, 10 | } 11 | 12 | func newBytes() interface{} { 13 | return make([]byte, 1024) 14 | } 15 | 16 | func BenchmarkSyncPoolGet(b *testing.B) { 17 | for i := 0; i < b.N; i++ { 18 | poolTest.Get() 19 | } 20 | } 21 | 22 | func BenchmarkDirectAlloc(b *testing.B) { 23 | for i := 0; i < b.N; i++ { 24 | newBytes() 25 | } 26 | } -------------------------------------------------------------------------------- /internal/rt/stubs_test.go: -------------------------------------------------------------------------------- 1 | package rt 2 | 3 | import ( 4 | "reflect" 5 | "testing" 6 | "unsafe" 7 | 8 | "github.com/stretchr/testify/assert" 9 | ) 10 | 11 | 12 | func TestStubsMake(t *testing.T) { 13 | t.Run("NonPtr", func(t *testing.T) { 14 | old := &[]int{} 15 | news := MakeSlice(unsafe.Pointer(old), UnpackType(reflect.TypeOf(int(1))), 10000) 16 | new := *(*[]int)(unsafe.Pointer(news)) 17 | for i := 0; i < 10000; i++ { 18 | assert.Equal(t, new[i], 0) 19 | } 20 | }) 21 | 22 | t.Run("HasPtr", func(t *testing.T) { 23 | old := &[]*int{} 24 | news := MakeSlice(unsafe.Pointer(old), UnpackType(reflect.TypeOf((*int)(nil))), 10000) 25 | new := *(*[]*int)(unsafe.Pointer(news)) 26 | for i := 0; i < 10000; i++ { 27 | assert.Equal(t, new[i], (*int)(nil)) 28 | } 29 | }) 30 | } -------------------------------------------------------------------------------- /issue_test/issue101_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package issue_test 18 | 19 | import ( 20 | `testing` 21 | . `github.com/bytedance/sonic` 22 | 23 | `github.com/davecgh/go-spew/spew` 24 | `github.com/stretchr/testify/require` 25 | ) 26 | 27 | func TestIssue101_UnmarshalMWithNumber(t *testing.T) { 28 | var v interface{} 29 | err := Unmarshal([]byte("M10"), &v) // MIJ` 30 | spew.Dump(v) 31 | require.Error(t, err) 32 | } -------------------------------------------------------------------------------- /issue_test/issue107_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package issue_test 18 | 19 | import ( 20 | `testing` 21 | . `github.com/bytedance/sonic` 22 | 23 | `github.com/stretchr/testify/require` 24 | ) 25 | 26 | func TestIssue107_UnmarshalUTF16SurrogatePairAfterInvalidUnicode(t *testing.T) { 27 | var obj string 28 | err := Unmarshal([]byte(`"\uDA51\uD83D\uDE04"`), &obj) 29 | require.NoError(t, err) 30 | require.Equal(t, obj, "\ufffd" + `😄`) 31 | } 32 | 33 | -------------------------------------------------------------------------------- /issue_test/issue108_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package issue_test 18 | 19 | import ( 20 | `testing` 21 | . `github.com/bytedance/sonic` 22 | 23 | `github.com/stretchr/testify/require` 24 | ) 25 | 26 | type Issue108_SkipNumberTest struct { 27 | } 28 | 29 | func TestIssue108_SkipExponentWithZeroBase(t *testing.T) { 30 | var obj Issue108_SkipNumberTest 31 | err := Unmarshal([]byte(`{"X":0e0}`), &obj) 32 | require.NoError(t, err) 33 | } 34 | 35 | -------------------------------------------------------------------------------- /issue_test/issue112_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package issue_test 18 | 19 | import ( 20 | `testing` 21 | 22 | . `github.com/bytedance/sonic` 23 | `github.com/stretchr/testify/require` 24 | ) 25 | 26 | func TestUnmarshalInvalidBase64EncodedString(t *testing.T) { 27 | var obj []byte 28 | data := `"123456"` 29 | err := Unmarshal([]byte(data), &obj) 30 | require.Error(t, err) 31 | 32 | data = `"1234;"` 33 | err = Unmarshal([]byte(data), &obj) 34 | require.Error(t, err) 35 | } 36 | 37 | -------------------------------------------------------------------------------- /issue_test/issue248_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package issue_test 18 | 19 | import ( 20 | `testing` 21 | 22 | `github.com/bytedance/sonic` 23 | `github.com/stretchr/testify/require` 24 | ) 25 | 26 | func TestIssue248(t *testing.T) { 27 | var d = `{}` 28 | n, err := sonic.GetFromString(d) 29 | require.Nil(t, err) 30 | v := n.GetByPath("a", 0) 31 | require.Nil(t, v) 32 | s, err := v.Get("a").Index(0).String() 33 | require.NotNil(t, err) 34 | require.Equal(t, "", s) 35 | } -------------------------------------------------------------------------------- /issue_test/issue507_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package issue_test 18 | 19 | import ( 20 | `testing` 21 | 22 | `github.com/bytedance/sonic/ast` 23 | `github.com/bytedance/sonic/internal/native/types` 24 | `github.com/stretchr/testify/assert` 25 | ) 26 | 27 | func TestRandomData(t *testing.T) { 28 | number := " 222222222" 29 | node, code := ast.NewParser(number[:3]).Parse() 30 | assert.Equal(t, code, types.ParsingError(0x0)) 31 | out, err := node.String() 32 | assert.Equal(t, out, "2") 33 | assert.NoError(t, err) 34 | } -------------------------------------------------------------------------------- /issue_test/issue5_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package issue_test 18 | 19 | import ( 20 | . `github.com/bytedance/sonic` 21 | `testing` 22 | 23 | `github.com/stretchr/testify/require` 24 | ) 25 | 26 | func TestIssue5(t *testing.T) { 27 | var x int 28 | var i interface{} = &x 29 | err := Unmarshal([]byte(`1`), &i) 30 | require.NoError(t, err) 31 | require.Equal(t, 1, x) 32 | } -------------------------------------------------------------------------------- /issue_test/issue67_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package issue_test 18 | 19 | import ( 20 | . `github.com/bytedance/sonic` 21 | `encoding/json` 22 | `testing` 23 | ) 24 | 25 | func TestIssue67_JunkAfterJSON(t *testing.T) { 26 | data := `1e2e3` 27 | var stdobj, sonicobj interface{} 28 | stderr := json.Unmarshal([]byte(data), &stdobj) 29 | sonicerr := Unmarshal([]byte(data), &sonicobj) 30 | if (stderr == nil) != (sonicerr == nil) { 31 | t.Fatalf("exp err: \n%#v, \ngot err: \n%#v\n", stderr, sonicerr) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /issue_test/issue739_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 CloudWeGo Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package issue_test 16 | 17 | import ( 18 | "testing" 19 | 20 | "github.com/bytedance/sonic" 21 | "github.com/stretchr/testify/assert" 22 | ) 23 | 24 | type myfoo struct{} 25 | 26 | func TestIssue739(t *testing.T) { 27 | var bar myfoo 28 | s := `{"a":"b 29 | c"}` 30 | assert.NoError(t, sonic.ConfigDefault.UnmarshalFromString(s, &bar)) 31 | assert.Error(t, sonic.ConfigStd.UnmarshalFromString(s, &bar)) 32 | } -------------------------------------------------------------------------------- /issue_test/issue750_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 CloudWeGo Authors 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package issue_test 16 | 17 | import ( 18 | "testing" 19 | 20 | "github.com/bytedance/sonic" 21 | ) 22 | 23 | func genSlice() interface{} { 24 | a := []string{} 25 | return &[]interface{}{&a} 26 | } 27 | 28 | func TestSlicePointer_Issue750(t *testing.T) { 29 | assertUnmarshal(t, sonic.ConfigStd, unmTestCase{ 30 | name: "non-empty eface slice", 31 | newfn: genSlice, 32 | data: []byte(`["one","2"]`), 33 | }) 34 | } -------------------------------------------------------------------------------- /issue_test/issue755_test.go: -------------------------------------------------------------------------------- 1 | package issue_test 2 | 3 | import ( 4 | "testing" 5 | "github.com/bytedance/sonic" 6 | ) 7 | 8 | var _emptyFunc func() 9 | 10 | func TestIssue755_NilEfaceWithDirectValue(t *testing.T) { 11 | tests := []interface{} { 12 | struct { 13 | Foo *int 14 | }{}, 15 | struct { 16 | Foo func() 17 | }{}, 18 | chan int(nil), 19 | _emptyFunc, 20 | } 21 | for _, v := range(tests) { 22 | assertMarshal(t, sonic.ConfigDefault, v) 23 | } 24 | } 25 | 26 | type NilMarshaler struct {} 27 | 28 | func (n *NilMarshaler) MarshalJSON() ([]byte, error) { 29 | if n == nil { 30 | return []byte(`"my null value"`), nil 31 | } 32 | return []byte(`{}`), nil 33 | } 34 | 35 | func TestIssue755_MarshalIface(t *testing.T) { 36 | tests := []interface{} { 37 | &NilMarshaler{}, 38 | (*NilMarshaler)(nil), 39 | } 40 | for _, v := range(tests) { 41 | assertMarshal(t, sonic.ConfigDefault, v) 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /issue_test/issue762_test.go: -------------------------------------------------------------------------------- 1 | package issue_test 2 | 3 | import ( 4 | "log" 5 | "sync" 6 | "testing" 7 | 8 | "github.com/bytedance/sonic" 9 | ) 10 | 11 | type MyJs struct { 12 | Arr [][2]string 13 | } 14 | 15 | func TestIssue762(t *testing.T) { 16 | type parsedStruct struct { 17 | parsed MyJs 18 | err error 19 | } 20 | conv := func(buf []byte) parsedStruct { 21 | var x MyJs 22 | err := sonic.Unmarshal(buf, &x) 23 | return parsedStruct{x, err} 24 | } 25 | 26 | const msg = `{"Arr":[["foo","bar"]]}` 27 | log.Printf("%#v\n", conv([]byte(msg))) 28 | 29 | var wg sync.WaitGroup 30 | for i := 0; i < 20; i++ { 31 | wg.Add(1) 32 | go func() { 33 | defer wg.Done() 34 | for j :=0; j < 5000; j++ { 35 | conv([]byte(msg)) 36 | } 37 | }() 38 | } 39 | wg.Wait() 40 | log.Println("wg done") 41 | } -------------------------------------------------------------------------------- /issue_test/issue772_test.go: -------------------------------------------------------------------------------- 1 | 2 | package issue_test 3 | 4 | import ( 5 | "testing" 6 | 7 | "github.com/bytedance/sonic" 8 | ) 9 | 10 | func TestIssue772_SkipIfaceType(t *testing.T) { 11 | for _, cas := range []unmTestCase { 12 | { 13 | name: "should skip non-ptr iface type", 14 | data: []byte(`{"id": {"id": "2"},"name": "name"}`), 15 | newfn: func() interface{} { 16 | obj := WrapperEface { 17 | } 18 | obj.Id = fooEface3{} 19 | return &obj 20 | }, 21 | }, 22 | { 23 | name: "should skip nil iface type", 24 | data: []byte(`{"id": {"id": "2"},"name": "name"}`), 25 | newfn: func() interface{} { 26 | obj := WrapperEface { 27 | } 28 | obj.Id = (*fooEface)(nil) 29 | return &obj 30 | }, 31 | }, 32 | } { 33 | t.Run(cas.name, func(t *testing.T) { 34 | assertUnmarshal(t, sonic.ConfigDefault, cas, true) 35 | }) 36 | } 37 | } 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /issue_test/issue774_test.go: -------------------------------------------------------------------------------- 1 | package issue_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "encoding/json" 7 | 8 | "github.com/bytedance/sonic" 9 | "github.com/stretchr/testify/require" 10 | ) 11 | 12 | func TestIssue774_EmptyStringForByteSlice(t *testing.T) { 13 | var jv, sv struct { 14 | ByteArr []byte 15 | } 16 | 17 | err := sonic.Unmarshal([]byte(`{"ByteArr": ""}`), &sv) 18 | err2 := json.Unmarshal([]byte(`{"ByteArr": ""}`), &jv) 19 | require.Equal(t, err2 == nil, err == nil) 20 | require.Equal(t, jv, sv) 21 | } -------------------------------------------------------------------------------- /issue_test/issue7_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package issue_test 18 | 19 | import ( 20 | . `github.com/bytedance/sonic` 21 | `testing` 22 | 23 | `github.com/stretchr/testify/require` 24 | ) 25 | 26 | func TestIssue7(t *testing.T) { 27 | v := &[...]int{1, 2, 3, 4, 5, 6, 7} 28 | err := Unmarshal([]byte(`[3]`), v) 29 | require.Nil(t, err) 30 | require.Equal(t, &[...]int{3, 0, 0, 0, 0, 0, 0}, v) 31 | } 32 | -------------------------------------------------------------------------------- /issue_test/issue90_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package issue_test 18 | 19 | import ( 20 | . `github.com/bytedance/sonic` 21 | `encoding/json` 22 | `fmt` 23 | `testing` 24 | ) 25 | 26 | func TestUnmarshalInfinity(t *testing.T) { 27 | var v interface{} 28 | data := []byte("9e370") 29 | sonicerr := Unmarshal(data, &v) 30 | stderr := json.Unmarshal(data, &v) 31 | if sonicerr == nil && stderr != nil { 32 | t.Errorf("should have unmarshal error like %#v\n", stderr) 33 | } 34 | fmt.Println(sonicerr, stderr) 35 | } 36 | -------------------------------------------------------------------------------- /issue_test/issue98_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package issue_test 18 | 19 | import ( 20 | `testing` 21 | 22 | `github.com/bytedance/sonic/encoder` 23 | `github.com/stretchr/testify/require` 24 | ) 25 | 26 | func TestIssue98_SingleElementMapWithKeySorting(t *testing.T) { 27 | v, err := encoder.Encode(map[int64]bool{1234: true}, encoder.SortMapKeys) 28 | require.NoError(t, err) 29 | require.Equal(t, `{"1234":true}`, string(v)) 30 | } 31 | -------------------------------------------------------------------------------- /issue_test/plugin/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | `fmt` 5 | 6 | `github.com/bytedance/sonic` 7 | ) 8 | 9 | var V int 10 | 11 | var Obj map[string]string 12 | 13 | func init() { 14 | if err := sonic.UnmarshalString(`{"a":"b"}`, &Obj); err != nil { 15 | panic(err) 16 | } 17 | } 18 | 19 | func F() { fmt.Printf("Hello, number %d\n", V) } 20 | 21 | func Unmarshal(json string, val interface{}) error { 22 | return sonic.UnmarshalString(json, val) 23 | } 24 | -------------------------------------------------------------------------------- /licenses/LICENSE-yyjson: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 YaoYuan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /loader/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/bytedance/sonic/loader 2 | 3 | go 1.16 4 | 5 | require ( 6 | github.com/davecgh/go-spew v1.1.1 7 | github.com/stretchr/testify v1.8.1 8 | ) 9 | -------------------------------------------------------------------------------- /loader/internal/abi/stubs.go: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package abi 18 | 19 | import ( 20 | _ `unsafe` 21 | 22 | `github.com/bytedance/sonic/loader/internal/rt` 23 | ) 24 | 25 | const ( 26 | _G_stackguard0 = 0x10 27 | ) 28 | 29 | var ( 30 | F_morestack_noctxt = uintptr(rt.FuncAddr(morestack_noctxt)) 31 | ) 32 | 33 | //go:linkname morestack_noctxt runtime.morestack_noctxt 34 | func morestack_noctxt() 35 | 36 | -------------------------------------------------------------------------------- /loader/internal/iasm/expr/parser_test.go: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2024 CloudWeGo Authors 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | package expr 18 | 19 | import ( 20 | "testing" 21 | 22 | "github.com/stretchr/testify/assert" 23 | "github.com/stretchr/testify/require" 24 | ) 25 | 26 | func TestParser_Eval(t *testing.T) { 27 | p := new(Parser).SetSource(`3 - 2 * (5 + 6) ** 4 / 7 + (1 << (1234 % 23)) & 0x5436 ^ 0x5a5a - 2 | 1`) 28 | v, err := p.Parse(nil) 29 | require.NoError(t, err) 30 | r, err := v.Evaluate() 31 | require.NoError(t, err) 32 | assert.Equal(t, int64(7805), r) 33 | } 34 | -------------------------------------------------------------------------------- /loader/internal/iasm/expr/pools.go: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2024 CloudWeGo Authors 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | package expr 18 | 19 | import ( 20 | "sync" 21 | ) 22 | 23 | var ( 24 | expressionPool sync.Pool 25 | ) 26 | 27 | func newExpression() *Expr { 28 | if v := expressionPool.Get(); v == nil { 29 | return new(Expr) 30 | } else { 31 | return resetExpression(v.(*Expr)) 32 | } 33 | } 34 | 35 | func freeExpression(p *Expr) { 36 | expressionPool.Put(p) 37 | } 38 | 39 | func resetExpression(p *Expr) *Expr { 40 | *p = Expr{} 41 | return p 42 | } 43 | -------------------------------------------------------------------------------- /loader/internal/iasm/expr/term.go: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2024 CloudWeGo Authors 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | package expr 18 | 19 | // Term represents a value that can Evaluate() into an integer. 20 | type Term interface { 21 | Free() 22 | Evaluate() (int64, error) 23 | } 24 | -------------------------------------------------------------------------------- /loader/internal/iasm/x86_64/asm.s: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2024 CloudWeGo Authors 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | -------------------------------------------------------------------------------- /loader/internal/iasm/x86_64/instructions_table.go: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2024 CloudWeGo Authors 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | // Code generated by "mkasm_amd64.py", DO NOT EDIT. 18 | 19 | package x86_64 20 | 21 | const ( 22 | _N_args = 5 23 | _N_forms = 23 24 | ) 25 | -------------------------------------------------------------------------------- /loader/loader.go: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package loader 18 | 19 | import ( 20 | `unsafe` 21 | ) 22 | 23 | // Function is a function pointer 24 | type Function unsafe.Pointer 25 | 26 | // Options used to load a module 27 | type Options struct { 28 | // NoPreempt is used to disable async preemption for this module 29 | NoPreempt bool 30 | } 31 | 32 | // Loader is a helper used to load a module simply 33 | type Loader struct { 34 | Name string // module name 35 | File string // file name 36 | Options 37 | } 38 | -------------------------------------------------------------------------------- /loader/register_tango.go: -------------------------------------------------------------------------------- 1 | // +build bytedance_tango 2 | 3 | /** 4 | * Copyright 2024 ByteDance Inc. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package loader 20 | 21 | import ( 22 | "sync" 23 | _ "unsafe" 24 | ) 25 | 26 | //go:linkname pluginsMu plugin.pluginsMu 27 | var pluginsMu sync.Mutex 28 | 29 | func registerModule(mod *moduledata) { 30 | pluginsMu.Lock() 31 | defer pluginsMu.Unlock() 32 | lastmoduledatap.next = mod 33 | lastmoduledatap = mod 34 | } 35 | -------------------------------------------------------------------------------- /loader/stubs.go: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package loader 18 | 19 | import ( 20 | _ `unsafe` 21 | ) 22 | 23 | //go:linkname lastmoduledatap runtime.lastmoduledatap 24 | //goland:noinspection GoUnusedGlobalVariable 25 | var lastmoduledatap *moduledata 26 | 27 | //go:linkname moduledataverify1 runtime.moduledataverify1 28 | func moduledataverify1(_ *moduledata) 29 | -------------------------------------------------------------------------------- /native/i64toa.c: -------------------------------------------------------------------------------- 1 | #include "fastint.h" 2 | 3 | 4 | int i64toa(char *out, int64_t val) { 5 | return i64toa_1(out, val); 6 | } -------------------------------------------------------------------------------- /native/lspace.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 ByteDance Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "native.h" 18 | #include "lspace.h" 19 | 20 | size_t lspace(const char *sp, size_t nb, size_t p) { 21 | return lspace_1(sp, nb, p); 22 | } 23 | -------------------------------------------------------------------------------- /native/skip_array.c: -------------------------------------------------------------------------------- 1 | #include "scanning.h" 2 | 3 | long skip_array(const GoString *src, long *p, StateMachine *m, uint64_t flags) { 4 | fsm_init(m, FSM_ARR_0); 5 | return fsm_exec_1(m, src, p, flags); 6 | } 7 | -------------------------------------------------------------------------------- /native/skip_number.c: -------------------------------------------------------------------------------- 1 | #include "scanning.h" 2 | 3 | long skip_number(const GoString *src, long *p) { 4 | return skip_number_1(src, p); 5 | } -------------------------------------------------------------------------------- /native/skip_object.c: -------------------------------------------------------------------------------- 1 | #include "scanning.h" 2 | 3 | long skip_object(const GoString *src, long *p, StateMachine *m, uint64_t flags) { 4 | fsm_init(m, FSM_OBJ_0); 5 | return fsm_exec_1(m, src, p, flags); 6 | } 7 | -------------------------------------------------------------------------------- /native/skip_one.c: -------------------------------------------------------------------------------- 1 | #include "scanning.h" 2 | 3 | long skip_one(const GoString *src, long *p, StateMachine *m, uint64_t flags) { 4 | return skip_one_1(src, p, m, flags); 5 | } 6 | -------------------------------------------------------------------------------- /native/skip_one_fast.c: -------------------------------------------------------------------------------- 1 | #include "scanning.h" 2 | 3 | long skip_one_fast(const GoString *src, long *p) { 4 | return skip_one_fast_1(src, p); 5 | } -------------------------------------------------------------------------------- /native/u64toa.c: -------------------------------------------------------------------------------- 1 | #include "fastint.h" 2 | 3 | 4 | int u64toa(char *out, uint64_t val) { 5 | return u64toa_1(out, val); 6 | } 7 | -------------------------------------------------------------------------------- /native/unittest/test_fastfint.c: -------------------------------------------------------------------------------- 1 | #include "native.c" 2 | #include 3 | #include 4 | 5 | void test_u64toa(uint64_t input, const char* expect) { 6 | char buf[64] = {0}; 7 | u64toa(buf, input); 8 | assert(strcmp(expect, buf) == 0); 9 | } 10 | 11 | int main() { 12 | test_u64toa(0, "0"); 13 | test_u64toa(1, "1"); 14 | test_u64toa(1345, "1345"); 15 | // test max uint64 16 | test_u64toa(18446744073709551615ULL, "18446744073709551615"); 17 | } -------------------------------------------------------------------------------- /native/unittest/test_to_lower.c: -------------------------------------------------------------------------------- 1 | #include "../to_lower.c" 2 | #include 3 | #include 4 | 5 | void test_to_lower(const char* input, const char* expect) { 6 | unsigned long len = strlen(input); 7 | char* dst = (char*)malloc(len); 8 | to_lower(dst, input, len); 9 | assert(strncmp(expect, dst, len) == 0); 10 | free(dst); 11 | } 12 | 13 | int main() { 14 | test_to_lower("Hello, World!", "hello, world!"); 15 | test_to_lower("12345", "12345"); 16 | test_to_lower("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz"); 17 | } -------------------------------------------------------------------------------- /native/validate_one.c: -------------------------------------------------------------------------------- 1 | #include "scanning.h" 2 | 3 | long validate_one(const GoString *src, long *p, StateMachine *m, uint64_t flags) { 4 | fsm_init(m, FSM_VAL); 5 | return fsm_exec_1(m, src, p, flags); 6 | } 7 | -------------------------------------------------------------------------------- /native/validate_utf8.c: -------------------------------------------------------------------------------- 1 | #include "scanning.h" 2 | 3 | long validate_utf8(const GoString *src, long *p, StateMachine *m) { 4 | xassert(*p >= 0 && src->len > *p); 5 | return validate_utf8_with_errors(src->buf, src->len, p, m); 6 | } -------------------------------------------------------------------------------- /native/validate_utf8_fast.c: -------------------------------------------------------------------------------- 1 | #include "scanning.h" 2 | 3 | // validate_utf8_fast returns zero if valid, otherwise, the error position. 4 | long validate_utf8_fast(const GoString *s) { 5 | #if USE_AVX2 6 | /* fast path for valid utf8 */ 7 | if (validate_utf8_avx2(s) == 0) { 8 | return 0; 9 | } 10 | #endif 11 | return validate_utf8_errors(s); 12 | } -------------------------------------------------------------------------------- /native/vnumber.c: -------------------------------------------------------------------------------- 1 | #include "scanning.h" 2 | 3 | 4 | void vnumber(const GoString *src, long *p, JsonState *ret) { 5 | return vnumber_1(src, p, ret); 6 | } -------------------------------------------------------------------------------- /native/vsigned.c: -------------------------------------------------------------------------------- 1 | #include "scanning.h" 2 | 3 | void vsigned(const GoString *src, long *p, JsonState *ret) { 4 | int64_t sgn = 1; 5 | vinteger(int64_t, sgn, sgn = -1); 6 | } 7 | -------------------------------------------------------------------------------- /native/vstring.c: -------------------------------------------------------------------------------- 1 | #include "vstring.h" 2 | 3 | void vstring(const GoString *src, long *p, JsonState *ret, uint64_t flags) { 4 | return vstring_1(src, p, ret, flags); 5 | } 6 | -------------------------------------------------------------------------------- /native/vstring.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "scanning.h" 5 | 6 | static always_inline void vstring_1(const GoString *src, long *p, JsonState *ret, uint64_t flags) { 7 | int64_t v = -1; 8 | int64_t i = *p; 9 | ssize_t e = advance_string(src, i, &v, flags); 10 | 11 | /* check for errors */ 12 | if (e < 0) { 13 | *p = src->len; 14 | ret->vt = e; 15 | return; 16 | } 17 | 18 | /* update the result, and fix the escape position (escaping past the end of string) */ 19 | *p = e; 20 | ret->iv = i; 21 | ret->vt = V_STRING; 22 | ret->ep = v >= e ? -1 : v; 23 | } 24 | -------------------------------------------------------------------------------- /native/vunsigned.c: -------------------------------------------------------------------------------- 1 | #include "scanning.h" 2 | 3 | void vunsigned(const GoString *src, long *p, JsonState *ret) { 4 | vinteger(uint64_t, 1, { 5 | *p = i - 1; 6 | ret->vt = -ERR_NUMBER_FMT; 7 | return; 8 | }) 9 | } 10 | -------------------------------------------------------------------------------- /scripts/bench-arm.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | pwd=$(pwd) 4 | export SONIC_NO_ASYNC_GC=1 5 | 6 | cd $pwd/ast 7 | go test -benchmem -run=^$ -benchtime=1000000x -bench "^(BenchmarkGet.*|BenchmarkSet.*)$" 8 | 9 | go test -benchmem -run=^$ -benchtime=10000x -bench "^(BenchmarkParser_.*|BenchmarkEncode.*)$" 10 | 11 | go test -benchmem -run=^$ -benchtime=10000000x -bench "^(BenchmarkNodeGetByPath|BenchmarkStructGetByPath|BenchmarkNodeIndex|BenchmarkStructIndex|BenchmarkSliceIndex|BenchmarkMapIndex|BenchmarkNodeGet|BenchmarkSliceGet|BenchmarkMapGet|BenchmarkNodeSet|BenchmarkMapSet|BenchmarkNodeSetByIndex|BenchmarkSliceSetByIndex|BenchmarkStructSetByIndex|BenchmarkNodeUnset|BenchmarkMapUnset|BenchmarkNodUnsetByIndex|BenchmarkSliceUnsetByIndex|BenchmarkNodeAdd|BenchmarkSliceAdd|BenchmarkMapAdd)$" 12 | 13 | unset SONIC_NO_ASYNC_GC 14 | cd $pwd -------------------------------------------------------------------------------- /scripts/check_branch_name.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | current=$(git status | head -n1 | sed 's/On branch //') 4 | name=${1:-$current} 5 | if [[ ! $name =~ ^(((opt(imize)?|feat(ure)?|doc|(bug|hot)?fix|test|refact(or)?|ci)/.+)|(main|develop)|(release/.+)|(release-v[0-9]+\.[0-9]+)|(release/v[0-9]+\.[0-9]+\.[0-9]+(-[a-z0-9.]+(\+[a-z0-9.]+)?)?)|revert-[a-z0-9]+)$ ]]; then 6 | echo "branch name '$name' is invalid" 7 | exit 1 8 | else 9 | echo "branch name '$name' is valid" 10 | fi 11 | -------------------------------------------------------------------------------- /scripts/go_flags.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -xe 4 | 5 | if [ -n "$_GO_FLAGS_LOADED" ]; then 6 | return 7 | fi 8 | _GO_FLAGS_LOADED=1 9 | 10 | get_go_linkname_flag() { 11 | if ! command -v go &> /dev/null; then 12 | return 1 13 | fi 14 | 15 | local go_version 16 | go_version=$(go version | awk '{print $3}' | sed -E 's/go([0-9]+\.[0-9]+(\.[0-9]+)?).*/\1/') 17 | IFS='.' read -r major minor _ <<< "$go_version" 18 | 19 | if ! [[ "$major" =~ ^[0-9]+$ ]] || ! [[ "$minor" =~ ^[0-9]+$ ]]; then 20 | return 1 21 | fi 22 | 23 | if (( major > 1 || (major == 1 && minor >= 23) )); then 24 | echo "-ldflags=-checklinkname=0" 25 | fi 26 | } -------------------------------------------------------------------------------- /scripts/qemu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | arch=$(uname -m) 3 | if echo $arch | grep -q 'arm'; then 4 | printf ' #!/bin/bash\n if [ ! -x "/usr/bin/qemu-x86_64" ];then\n sudo apt-get update\n sudo apt-get -y install make gcc g++ libglib2.0-dev libpixman-1-dev libfdt-dev python3-pip ninja-build\n sudo pip3 install meson\n wget https://download.qemu.org/qemu-6.2.0.tar.xz\n tar -xvf qemu-6.2.0.tar.xz\n cd qemu-6.2.0\n sudo ./configure\n sudo make -j 4\n sudo make install\n cd ..\n cp /usr/local/bin/qemu-x86_64 /usr/bin/qemu-x86_64\n fi\n' > qemu_install.sh 5 | chmod +x qemu_install.sh 6 | ./qemu_install.sh 7 | GOARCH=amd64 go test -c . 8 | qemu-x86_64 -cpu max ./sonic.test -test.v 9 | fi -------------------------------------------------------------------------------- /scripts/test_race.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -xe 4 | 5 | source "$(dirname "$0")/../scripts/go_flags.sh" 6 | 7 | compile_flag=$(get_go_linkname_flag || echo "") 8 | 9 | cd ./issue_test 10 | cp race_test_go race_test.go 11 | go test "$compile_flag" -v -run=TestRaceEncode -race -count=100 . > test_race.log || true 12 | if ! grep -q "WARNING: DATA RACE" ./test_race.log; then 13 | echo "TEST FAILED: should data race here" 14 | exit 1 15 | fi 16 | mv race_test.go race_test_go 17 | rm -vrf test_race.log -------------------------------------------------------------------------------- /testdata/canada_geometry.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/sonic/a5ac536f86e855ee984145f7426db6bb7998d858/testdata/canada_geometry.json.gz -------------------------------------------------------------------------------- /testdata/citm_catalog.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/sonic/a5ac536f86e855ee984145f7426db6bb7998d858/testdata/citm_catalog.json.gz -------------------------------------------------------------------------------- /testdata/golang_source.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/sonic/a5ac536f86e855ee984145f7426db6bb7998d858/testdata/golang_source.json.gz -------------------------------------------------------------------------------- /testdata/string_escaped.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/sonic/a5ac536f86e855ee984145f7426db6bb7998d858/testdata/string_escaped.json.gz -------------------------------------------------------------------------------- /testdata/string_unicode.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/sonic/a5ac536f86e855ee984145f7426db6bb7998d858/testdata/string_unicode.json.gz -------------------------------------------------------------------------------- /testdata/synthea_fhir.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/sonic/a5ac536f86e855ee984145f7426db6bb7998d858/testdata/synthea_fhir.json.gz -------------------------------------------------------------------------------- /testdata/twitter_status.json.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bytedance/sonic/a5ac536f86e855ee984145f7426db6bb7998d858/testdata/twitter_status.json.gz -------------------------------------------------------------------------------- /tools/asm2arm/requirements.txt: -------------------------------------------------------------------------------- 1 | git+https://github.com/Maratyszcza/PeachPy 2 | git+https://github.com/GrammaTech/mc-asm 3 | --------------------------------------------------------------------------------