diff options
Diffstat (limited to 'vendor/github.com/bytedance/sonic/internal/decoder/jitdec')
10 files changed, 105 insertions, 269 deletions
diff --git a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/asm_stubs_amd64_go117.go b/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/asm_stubs_amd64_go117.go index 48f73e5bf..5a455ebd5 100644 --- a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/asm_stubs_amd64_go117.go +++ b/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/asm_stubs_amd64_go117.go @@ -20,21 +20,16 @@ import ( `strconv` `unsafe` + `github.com/bytedance/sonic/internal/rt` `github.com/bytedance/sonic/internal/jit` `github.com/twitchyliquid64/golang-asm/obj` `github.com/twitchyliquid64/golang-asm/obj/x86` ) -//go:linkname _runtime_writeBarrier runtime.writeBarrier -var _runtime_writeBarrier uintptr - -//go:linkname gcWriteBarrierAX runtime.gcWriteBarrier -func gcWriteBarrierAX() - var ( - _V_writeBarrier = jit.Imm(int64(uintptr(unsafe.Pointer(&_runtime_writeBarrier)))) + _V_writeBarrier = jit.Imm(int64(uintptr(unsafe.Pointer(&rt.RuntimeWriteBarrier)))) - _F_gcWriteBarrierAX = jit.Func(gcWriteBarrierAX) + _F_gcWriteBarrierAX = jit.Func(rt.GcWriteBarrierAX) ) func (self *_Assembler) WritePtrAX(i int, rec obj.Addr, saveDI bool) { diff --git a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/asm_stubs_amd64_go121.go b/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/asm_stubs_amd64_go121.go index cbec3d248..d6101b2e6 100644 --- a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/asm_stubs_amd64_go121.go +++ b/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/asm_stubs_amd64_go121.go @@ -1,4 +1,4 @@ -// +build go1.21,!go1.24 +// +build go1.21,!go1.25 // Copyright 2023 CloudWeGo Authors // @@ -20,25 +20,19 @@ import ( `strconv` `unsafe` + `github.com/bytedance/sonic/internal/rt` `github.com/bytedance/sonic/internal/jit` `github.com/twitchyliquid64/golang-asm/obj` `github.com/twitchyliquid64/golang-asm/obj/x86` ) -//go:linkname _runtime_writeBarrier runtime.writeBarrier -var _runtime_writeBarrier uintptr - -//go:nosplit -//go:linkname gcWriteBarrier2 runtime.gcWriteBarrier2 -func gcWriteBarrier2() - // Notice: gcWriteBarrier must use R11 register!! var _R11 = _IC var ( - _V_writeBarrier = jit.Imm(int64(uintptr(unsafe.Pointer(&_runtime_writeBarrier)))) + _V_writeBarrier = jit.Imm(int64(uintptr(unsafe.Pointer(&rt.RuntimeWriteBarrier)))) - _F_gcWriteBarrier2 = jit.Func(gcWriteBarrier2) + _F_gcWriteBarrier2 = jit.Func(rt.GcWriteBarrier2) ) func (self *_Assembler) WritePtrAX(i int, rec obj.Addr, saveDI bool) { diff --git a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/assembler_regabi_amd64.go b/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/assembler_regabi_amd64.go index 42b8b502f..20c115e79 100644 --- a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/assembler_regabi_amd64.go +++ b/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/assembler_regabi_amd64.go @@ -1,5 +1,5 @@ -//go:build go1.17 && !go1.24 -// +build go1.17,!go1.24 +//go:build go1.17 && !go1.25 +// +build go1.17,!go1.25 /* * Copyright 2021 ByteDance Inc. @@ -271,6 +271,7 @@ var _OpFuncTab = [256]func(*_Assembler, *_Instr) { _OP_nil_1 : (*_Assembler)._asm_OP_nil_1, _OP_nil_2 : (*_Assembler)._asm_OP_nil_2, _OP_nil_3 : (*_Assembler)._asm_OP_nil_3, + _OP_empty_bytes : (*_Assembler)._asm_OP_empty_bytes, _OP_deref : (*_Assembler)._asm_OP_deref, _OP_index : (*_Assembler)._asm_OP_index, _OP_is_null : (*_Assembler)._asm_OP_is_null, @@ -313,9 +314,10 @@ var _OpFuncTab = [256]func(*_Assembler, *_Instr) { _OP_check_char_0 : (*_Assembler)._asm_OP_check_char_0, _OP_dismatch_err : (*_Assembler)._asm_OP_dismatch_err, _OP_go_skip : (*_Assembler)._asm_OP_go_skip, - _OP_skip_emtpy : (*_Assembler)._asm_OP_skip_empty, + _OP_skip_emtpy : (*_Assembler)._asm_OP_skip_empty, _OP_add : (*_Assembler)._asm_OP_add, _OP_check_empty : (*_Assembler)._asm_OP_check_empty, + _OP_unsupported : (*_Assembler)._asm_OP_unsupported, _OP_debug : (*_Assembler)._asm_OP_debug, } @@ -456,7 +458,7 @@ func (self *_Assembler) call_vf(fn obj.Addr) { /** Assembler Error Handlers **/ var ( - _F_convT64 = jit.Func(convT64) + _F_convT64 = jit.Func(rt.ConvT64) _F_error_wrap = jit.Func(error_wrap) _F_error_type = jit.Func(error_type) _F_error_field = jit.Func(error_field) @@ -598,7 +600,6 @@ func (self *_Assembler) _asm_OP_dismatch_err(p *_Instr) { func (self *_Assembler) _asm_OP_go_skip(p *_Instr) { self.Byte(0x4c, 0x8d, 0x0d) // LEAQ (PC), R9 self.Xref(p.vi(), 4) - // self.Byte(0xcc) self.Emit("MOVQ", _R9, _VAR_pc) self.Sjmp("JMP" , _LB_skip_one) // JMP _skip_one } @@ -606,9 +607,7 @@ func (self *_Assembler) _asm_OP_go_skip(p *_Instr) { var _F_IndexByte = jit.Func(strings.IndexByte) func (self *_Assembler) _asm_OP_skip_empty(p *_Instr) { - // self.Byte(0xcc) self.call_sf(_F_skip_one) // CALL_SF skip_one - // self.Byte(0xcc) self.Emit("TESTQ", _AX, _AX) // TESTQ AX, AX self.Sjmp("JS" , _LB_parsing_error_v) // JS _parse_error_v self.Emit("BTQ", jit.Imm(_F_disable_unknown), _ARG_fv) @@ -619,7 +618,6 @@ func (self *_Assembler) _asm_OP_skip_empty(p *_Instr) { self.Emit("MOVQ", _AX, _ARG_sv_p) self.Emit("MOVQ", jit.Imm(':'), _CX) self.call_go(_F_IndexByte) - // self.Byte(0xcc) self.Emit("TESTQ", _AX, _AX) // disallow unknown field self.Sjmp("JNS", _LB_field_error) @@ -662,7 +660,7 @@ func (self *_Assembler) skip_key_value() { var ( _T_byte = jit.Type(byteType) - _F_mallocgc = jit.Func(mallocgc) + _F_mallocgc = jit.Func(rt.Mallocgc) ) func (self *_Assembler) malloc_AX(nb obj.Addr, ret obj.Addr) { @@ -964,8 +962,8 @@ func (self *_Assembler) unquote_twice(p obj.Addr, n obj.Addr, stack bool) { /** Memory Clearing Routines **/ var ( - _F_memclrHasPointers = jit.Func(memclrHasPointers) - _F_memclrNoHeapPointers = jit.Func(memclrNoHeapPointers) + _F_memclrHasPointers = jit.Func(rt.MemclrHasPointers) + _F_memclrNoHeapPointers = jit.Func(rt.MemclrNoHeapPointers) ) func (self *_Assembler) mem_clear_fn(ptrfree bool) { @@ -989,10 +987,10 @@ func (self *_Assembler) mem_clear_rem(size int64, ptrfree bool) { /** Map Assigning Routines **/ var ( - _F_mapassign = jit.Func(mapassign) - _F_mapassign_fast32 = jit.Func(mapassign_fast32) - _F_mapassign_faststr = jit.Func(mapassign_faststr) - _F_mapassign_fast64ptr = jit.Func(mapassign_fast64ptr) + _F_mapassign = jit.Func(rt.Mapassign) + _F_mapassign_fast32 = jit.Func(rt.Mapassign_fast32) + _F_mapassign_faststr = jit.Func(rt.Mapassign_faststr) + _F_mapassign_fast64ptr = jit.Func(rt.Mapassign_fast64ptr) ) var ( @@ -1183,12 +1181,12 @@ func (self *_Assembler) decode_dynamic(vt obj.Addr, vp obj.Addr) { /** OpCode Assembler Functions **/ var ( - _F_memequal = jit.Func(memequal) - _F_memmove = jit.Func(memmove) + _F_memequal = jit.Func(rt.MemEqual) + _F_memmove = jit.Func(rt.Memmove) _F_growslice = jit.Func(rt.GrowSlice) - _F_makeslice = jit.Func(makeslice) - _F_makemap_small = jit.Func(makemap_small) - _F_mapassign_fast64 = jit.Func(mapassign_fast64) + _F_makeslice = jit.Func(rt.MakeSliceStd) + _F_makemap_small = jit.Func(rt.MakemapSmall) + _F_mapassign_fast64 = jit.Func(rt.Mapassign_fast64) ) var ( @@ -1197,7 +1195,7 @@ var ( ) var ( - _F_b64decode = jit.Imm(int64(_subr__b64decode)) + _F_b64decode = jit.Imm(int64(rt.SubrB64Decode)) _F_decodeValue = jit.Imm(int64(_subr_decode_value)) ) @@ -1253,18 +1251,42 @@ func (self *_Assembler) _asm_OP_any(_ *_Instr) { func (self *_Assembler) _asm_OP_dyn(p *_Instr) { self.Emit("MOVQ" , jit.Type(p.vt()), _ET) // MOVQ ${p.vt()}, ET self.Emit("CMPQ" , jit.Ptr(_VP, 8), jit.Imm(0)) // CMPQ 8(VP), $0 - self.Sjmp("JE" , _LB_type_error) // JE _type_error + self.Sjmp("JNE" , "_decode_dyn_non_nil_{n}") // JE _type_error + + /* if nil iface, call skip one */ + self.Emit("MOVQ", _IC, _VAR_ic) + self.Emit("MOVQ", _ET, _VAR_et) + self.Byte(0x4c, 0x8d, 0x0d) + self.Sref("_decode_end_{n}", 4) + self.Emit("MOVQ", _R9, _VAR_pc) + self.Sjmp("JMP" , _LB_skip_one) + + self.Link("_decode_dyn_non_nil_{n}") // _decode_dyn_non_nil_{n}: self.Emit("MOVQ" , jit.Ptr(_VP, 0), _CX) // MOVQ (VP), CX self.Emit("MOVQ" , jit.Ptr(_CX, 8), _CX) // MOVQ 8(CX), CX self.Emit("MOVBLZX", jit.Ptr(_CX, _Gt_KindFlags), _DX) // MOVBLZX _Gt_KindFlags(CX), DX self.Emit("ANDL" , jit.Imm(rt.F_kind_mask), _DX) // ANDL ${F_kind_mask}, DX self.Emit("CMPL" , _DX, jit.Imm(_Vk_Ptr)) // CMPL DX, ${reflect.Ptr} - self.Sjmp("JNE" , _LB_type_error) // JNE _type_error + self.Sjmp("JE" , "_decode_dyn_ptr_{n}") // JNE _type_error + + self.Emit("MOVQ", _IC, _VAR_ic) + self.Emit("MOVQ", _ET, _VAR_et) + self.Byte(0x4c, 0x8d, 0x0d) + self.Sref("_decode_end_{n}", 4) + self.Emit("MOVQ", _R9, _VAR_pc) + self.Sjmp("JMP" , _LB_skip_one) + + self.Link("_decode_dyn_ptr_{n}") // _decode_dyn_ptr_{n}: self.Emit("LEAQ" , jit.Ptr(_VP, 8), _DI) // LEAQ 8(VP), DI self.decode_dynamic(_CX, _DI) // DECODE CX, DI self.Link("_decode_end_{n}") // _decode_end_{n}: } +func (self *_Assembler) _asm_OP_unsupported(p *_Instr) { + self.Emit("MOVQ", jit.Type(p.vt()), _ET) // MOVQ ${p.vt()}, ET + self.Sjmp("JMP" , _LB_type_error) // JMP _LB_type_error +} + func (self *_Assembler) _asm_OP_str(_ *_Instr) { self.parse_string() // PARSE STRING self.unquote_once(jit.Ptr(_VP, 0), jit.Ptr(_VP, 8), false, true) // UNQUOTE once, (VP), 8(VP) @@ -1488,6 +1510,19 @@ func (self *_Assembler) _asm_OP_nil_3(_ *_Instr) { self.Emit("MOVQ" , _AX, jit.Ptr(_VP, 16)) // MOVOU AX, 16(VP) } +var ( + bytes []byte = make([]byte, 0) + zerobytes = (*rt.GoSlice)(unsafe.Pointer(&bytes)).Ptr + _ZERO_PTR = jit.Imm(int64(uintptr(zerobytes))) +) + +func (self *_Assembler) _asm_OP_empty_bytes(_ *_Instr) { + self.Emit("MOVQ", _ZERO_PTR, _AX) + self.Emit("PXOR" , _X0, _X0) + self.Emit("MOVQ", _AX, jit.Ptr(_VP, 0)) + self.Emit("MOVOU", _X0, jit.Ptr(_VP, 8)) +} + func (self *_Assembler) _asm_OP_deref(p *_Instr) { self.vfollow(p.vt()) } @@ -1547,7 +1582,7 @@ func (self *_Assembler) _asm_OP_map_key_i32(p *_Instr) { self.parse_signed(int32Type, "", p.vi()) // PARSE int32 self.range_signed_CX(_I_int32, _T_int32, math.MinInt32, math.MaxInt32) // RANGE int32 self.match_char('"') - if vt := p.vt(); !mapfast(vt) { + if vt := p.vt(); !rt.IsMapfast(vt) { self.mapassign_std(vt, _VAR_st_Iv) // MAPASSIGN int32, mapassign, st.Iv } else { self.Emit("MOVQ", _CX, _AX) // MOVQ CX, AX @@ -1558,7 +1593,7 @@ func (self *_Assembler) _asm_OP_map_key_i32(p *_Instr) { func (self *_Assembler) _asm_OP_map_key_i64(p *_Instr) { self.parse_signed(int64Type, "", p.vi()) // PARSE int64 self.match_char('"') - if vt := p.vt(); !mapfast(vt) { + if vt := p.vt(); !rt.IsMapfast(vt) { self.mapassign_std(vt, _VAR_st_Iv) // MAPASSIGN int64, mapassign, st.Iv } else { self.Emit("MOVQ", _VAR_st_Iv, _AX) // MOVQ st.Iv, AX @@ -1584,7 +1619,7 @@ func (self *_Assembler) _asm_OP_map_key_u32(p *_Instr) { self.parse_unsigned(uint32Type, "", p.vi()) // PARSE uint32 self.range_unsigned_CX(_I_uint32, _T_uint32, math.MaxUint32) // RANGE uint32 self.match_char('"') - if vt := p.vt(); !mapfast(vt) { + if vt := p.vt(); !rt.IsMapfast(vt) { self.mapassign_std(vt, _VAR_st_Iv) // MAPASSIGN uint32, vt.Iv } else { self.Emit("MOVQ", _CX, _AX) // MOVQ CX, AX @@ -1595,7 +1630,7 @@ func (self *_Assembler) _asm_OP_map_key_u32(p *_Instr) { func (self *_Assembler) _asm_OP_map_key_u64(p *_Instr) { self.parse_unsigned(uint64Type, "", p.vi()) // PARSE uint64 self.match_char('"') - if vt := p.vt(); !mapfast(vt) { + if vt := p.vt(); !rt.IsMapfast(vt) { self.mapassign_std(vt, _VAR_st_Iv) // MAPASSIGN uint64, vt.Iv } else { self.Emit("MOVQ", _VAR_st_Iv, _AX) // MOVQ st.Iv, AX @@ -1620,7 +1655,7 @@ func (self *_Assembler) _asm_OP_map_key_f64(p *_Instr) { func (self *_Assembler) _asm_OP_map_key_str(p *_Instr) { self.parse_string() // PARSE STRING self.unquote_once(_ARG_sv_p, _ARG_sv_n, true, true) // UNQUOTE once, sv.p, sv.n - if vt := p.vt(); !mapfast(vt) { + if vt := p.vt(); !rt.IsMapfast(vt) { self.valloc(vt.Key(), _DI) self.Emit("MOVOU", _ARG_sv, _X0) self.Emit("MOVOU", _X0, jit.Ptr(_DI, 0)) @@ -1794,6 +1829,8 @@ func (self *_Assembler) _asm_OP_struct_field(p *_Instr) { self.Emit("MOVQ" , _R8, _VAR_sr) // MOVQ R8, sr self.Sjmp("JMP" , "_end_{n}") // JMP _end_{n} self.Link("_try_lowercase_{n}") // _try_lowercase_{n}: + self.Emit("BTQ" , jit.Imm(_F_case_sensitive), _ARG_fv) // check if enable option CaseSensitive + self.Sjmp("JC" , "_unknown_{n}") self.Emit("MOVQ" , jit.Imm(referenceFields(p.vf())), _AX) // MOVQ ${p.vf()}, AX self.Emit("MOVQ", _ARG_sv_p, _BX) // MOVQ sv, BX self.Emit("MOVQ", _ARG_sv_n, _CX) // MOVQ sv, CX @@ -1801,6 +1838,10 @@ func (self *_Assembler) _asm_OP_struct_field(p *_Instr) { self.Emit("MOVQ" , _AX, _VAR_sr) // MOVQ AX, _VAR_sr self.Emit("TESTQ", _AX, _AX) // TESTQ AX, AX self.Sjmp("JNS" , "_end_{n}") // JNS _end_{n} + self.Link("_unknown_{n}") + // HACK: because `_VAR_sr` maybe used in `F_vstring`, so we should clear here again for `_OP_switch`. + self.Emit("MOVQ" , jit.Imm(-1), _AX) // MOVQ $-1, AX + self.Emit("MOVQ" , _AX, _VAR_sr) // MOVQ AX, sr self.Emit("BTQ" , jit.Imm(_F_disable_unknown), _ARG_fv) // BTQ ${_F_disable_unknown}, fv self.Sjmp("JC" , _LB_field_error) // JC _field_error self.Link("_end_{n}") // _end_{n}: diff --git a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/compiler.go b/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/compiler.go index 33191262a..8b3a19573 100644 --- a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/compiler.go +++ b/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/compiler.go @@ -54,6 +54,7 @@ const ( _OP_nil_1 _OP_nil_2 _OP_nil_3 + _OP_empty_bytes _OP_deref _OP_index _OP_is_null @@ -99,6 +100,7 @@ const ( _OP_skip_emtpy _OP_add _OP_check_empty + _OP_unsupported _OP_debug ) @@ -134,6 +136,7 @@ var _OpNames = [256]string { _OP_nil_1 : "nil_1", _OP_nil_2 : "nil_2", _OP_nil_3 : "nil_3", + _OP_empty_bytes : "empty bytes", _OP_deref : "deref", _OP_index : "index", _OP_is_null : "is_null", @@ -176,6 +179,7 @@ var _OpNames = [256]string { _OP_add : "add", _OP_go_skip : "go_skip", _OP_check_empty : "check_empty", + _OP_unsupported : "unsupported type", _OP_debug : "debug", } @@ -630,10 +634,17 @@ func (self *_Compiler) compileOps(p *_Program, sp int, vt reflect.Type) { case reflect.Ptr : self.compilePtr (p, sp, vt) case reflect.Slice : self.compileSlice (p, sp, vt) case reflect.Struct : self.compileStruct (p, sp, vt) - default : panic (&json.UnmarshalTypeError{Type: vt}) + default : self.compileUnsupportedType (p, vt) } } +func (self *_Compiler) compileUnsupportedType(p *_Program, vt reflect.Type) { + i := p.pc() + p.add(_OP_is_null) + p.rtt(_OP_unsupported, vt) + p.pin(i) +} + func (self *_Compiler) compileMap(p *_Program, sp int, vt reflect.Type) { if reflect.PtrTo(vt.Key()).Implements(encodingTextUnmarshalerType) { self.compileMapOp(p, sp, vt, _OP_map_key_utext_p) @@ -819,12 +830,19 @@ func (self *_Compiler) compileSliceBin(p *_Program, sp int, vt reflect.Type) { self.compileSliceBody(p, sp, vt.Elem()) y := p.pc() p.add(_OP_goto) + + // unmarshal `null` and `"` is different p.pin(i) - p.pin(k) p.add(_OP_nil_3) + y2 := p.pc() + p.add(_OP_goto) + + p.pin(k) + p.add(_OP_empty_bytes) p.pin(x) p.pin(skip) p.pin(y) + p.pin(y2) } func (self *_Compiler) compileSliceList(p *_Program, sp int, vt reflect.Type) { @@ -1135,13 +1153,11 @@ func (self *_Compiler) compileInterface(p *_Program, vt reflect.Type) { p.pin(j) } -func (self *_Compiler) compilePrimitive(vt reflect.Type, p *_Program, op _Op) { +func (self *_Compiler) compilePrimitive(_ reflect.Type, p *_Program, op _Op) { i := p.pc() p.add(_OP_is_null) - // skip := self.checkPrimitive(p, vt) p.add(op) p.pin(i) - // p.pin(skip) } func (self *_Compiler) compileUnmarshalEnd(p *_Program, vt reflect.Type, i int) { diff --git a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/decoder.go b/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/decoder.go index bbb4b4b61..de6325289 100644 --- a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/decoder.go +++ b/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/decoder.go @@ -27,6 +27,7 @@ const ( _F_use_number = consts.F_use_number _F_no_validate_json = consts.F_no_validate_json _F_validate_string = consts.F_validate_string + _F_case_sensitive = consts.F_case_sensitive ) var ( diff --git a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/generic_regabi_amd64.go b/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/generic_regabi_amd64.go index e6d5e3e84..51a850a8a 100644 --- a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/generic_regabi_amd64.go +++ b/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/generic_regabi_amd64.go @@ -1,4 +1,4 @@ -// +build go1.17,!go1.24 +// +build go1.17,!go1.25 /* * Copyright 2021 ByteDance Inc. @@ -27,6 +27,7 @@ import ( `github.com/bytedance/sonic/internal/native` `github.com/bytedance/sonic/internal/native/types` `github.com/twitchyliquid64/golang-asm/obj` + `github.com/bytedance/sonic/internal/rt` ) /** Crucial Registers: @@ -173,8 +174,8 @@ var ( ) var ( - _F_convTslice = jit.Func(convTslice) - _F_convTstring = jit.Func(convTstring) + _F_convTslice = jit.Func(rt.ConvTslice) + _F_convTstring = jit.Func(rt.ConvTstring) _F_invalid_vtype = jit.Func(invalid_vtype) ) @@ -725,5 +726,5 @@ var ( //go:nosplit func invalid_vtype(vt types.ValueType) { - throw(fmt.Sprintf("invalid value type: %d", vt)) + rt.Throw(fmt.Sprintf("invalid value type: %d", vt)) } diff --git a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/generic_regabi_amd64_test.s b/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/generic_regabi_amd64_test.s index 19ed3752f..f287eaeb4 100644 --- a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/generic_regabi_amd64_test.s +++ b/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/generic_regabi_amd64_test.s @@ -1,4 +1,4 @@ -// +build go1.17,!go1.24 +// +build go1.17,!go1.25 // // Copyright 2021 ByteDance Inc. diff --git a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/pools.go b/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/pools.go index 200af6a60..33ccd77e4 100644 --- a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/pools.go +++ b/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/pools.go @@ -102,7 +102,7 @@ func newStack() *_Stack { } func resetStack(p *_Stack) { - memclrNoHeapPointers(unsafe.Pointer(p), _StackSize) + rt.MemclrNoHeapPointers(unsafe.Pointer(p), _StackSize) } func freeStack(p *_Stack) { diff --git a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/stubs_go116.go b/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/stubs_go116.go deleted file mode 100644 index 8fa7c32fc..000000000 --- a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/stubs_go116.go +++ /dev/null @@ -1,106 +0,0 @@ -// +build go1.17,!go1.20 - -/* - * Copyright 2021 ByteDance Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package jitdec - -import ( - `unsafe` - `reflect` - - _ `github.com/cloudwego/base64x` - - `github.com/bytedance/sonic/internal/rt` -) - -//go:linkname _subr__b64decode github.com/cloudwego/base64x._subr__b64decode -var _subr__b64decode uintptr - -// runtime.maxElementSize -const _max_map_element_size uintptr = 128 - -func mapfast(vt reflect.Type) bool { - return vt.Elem().Size() <= _max_map_element_size -} - -//go:nosplit -//go:linkname throw runtime.throw -//goland:noinspection GoUnusedParameter -func throw(s string) - -//go:linkname convT64 runtime.convT64 -//goland:noinspection GoUnusedParameter -func convT64(v uint64) unsafe.Pointer - -//go:linkname convTslice runtime.convTslice -//goland:noinspection GoUnusedParameter -func convTslice(v []byte) unsafe.Pointer - -//go:linkname convTstring runtime.convTstring -//goland:noinspection GoUnusedParameter -func convTstring(v string) unsafe.Pointer - -//go:noescape -//go:linkname memequal runtime.memequal -//goland:noinspection GoUnusedParameter -func memequal(a unsafe.Pointer, b unsafe.Pointer, size uintptr) bool - -//go:noescape -//go:linkname memmove runtime.memmove -//goland:noinspection GoUnusedParameter -func memmove(to unsafe.Pointer, from unsafe.Pointer, n uintptr) - -//go:linkname mallocgc runtime.mallocgc -//goland:noinspection GoUnusedParameter -func mallocgc(size uintptr, typ *rt.GoType, needzero bool) unsafe.Pointer - -//go:linkname makeslice runtime.makeslice -//goland:noinspection GoUnusedParameter -func makeslice(et *rt.GoType, len int, cap int) unsafe.Pointer - -//go:linkname makemap_small runtime.makemap_small -func makemap_small() unsafe.Pointer - -//go:linkname mapassign runtime.mapassign -//goland:noinspection GoUnusedParameter -func mapassign(t *rt.GoType, h unsafe.Pointer, k unsafe.Pointer) unsafe.Pointer - -//go:linkname mapassign_fast32 runtime.mapassign_fast32 -//goland:noinspection GoUnusedParameter -func mapassign_fast32(t *rt.GoType, h unsafe.Pointer, k uint32) unsafe.Pointer - -//go:linkname mapassign_fast64 runtime.mapassign_fast64 -//goland:noinspection GoUnusedParameter -func mapassign_fast64(t *rt.GoType, h unsafe.Pointer, k uint64) unsafe.Pointer - -//go:linkname mapassign_fast64ptr runtime.mapassign_fast64ptr -//goland:noinspection GoUnusedParameter -func mapassign_fast64ptr(t *rt.GoType, h unsafe.Pointer, k unsafe.Pointer) unsafe.Pointer - -//go:linkname mapassign_faststr runtime.mapassign_faststr -//goland:noinspection GoUnusedParameter -func mapassign_faststr(t *rt.GoType, h unsafe.Pointer, s string) unsafe.Pointer - -//go:nosplit -//go:linkname memclrHasPointers runtime.memclrHasPointers -//goland:noinspection GoUnusedParameter -func memclrHasPointers(ptr unsafe.Pointer, n uintptr) - -//go:noescape -//go:linkname memclrNoHeapPointers runtime.memclrNoHeapPointers -//goland:noinspection GoUnusedParameter -func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
\ No newline at end of file diff --git a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/stubs_go120.go b/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/stubs_go120.go deleted file mode 100644 index a6dad26d7..000000000 --- a/vendor/github.com/bytedance/sonic/internal/decoder/jitdec/stubs_go120.go +++ /dev/null @@ -1,106 +0,0 @@ -// +build go1.20 - -/* - * Copyright 2021 ByteDance Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package jitdec - -import ( - `unsafe` - `reflect` - - _ `github.com/cloudwego/base64x` - - `github.com/bytedance/sonic/internal/rt` -) - -//go:linkname _subr__b64decode github.com/cloudwego/base64x._subr__b64decode -var _subr__b64decode uintptr - -// runtime.maxElementSize -const _max_map_element_size uintptr = 128 - -func mapfast(vt reflect.Type) bool { - return vt.Elem().Size() <= _max_map_element_size -} - -//go:nosplit -//go:linkname throw runtime.throw -//goland:noinspection GoUnusedParameter -func throw(s string) - -//go:linkname convT64 runtime.convT64 -//goland:noinspection GoUnusedParameter -func convT64(v uint64) unsafe.Pointer - -//go:linkname convTslice runtime.convTslice -//goland:noinspection GoUnusedParameter -func convTslice(v []byte) unsafe.Pointer - -//go:linkname convTstring runtime.convTstring -//goland:noinspection GoUnusedParameter -func convTstring(v string) unsafe.Pointer - -//go:noescape -//go:linkname memequal runtime.memequal -//goland:noinspection GoUnusedParameter -func memequal(a unsafe.Pointer, b unsafe.Pointer, size uintptr) bool - -//go:noescape -//go:linkname memmove runtime.memmove -//goland:noinspection GoUnusedParameter -func memmove(to unsafe.Pointer, from unsafe.Pointer, n uintptr) - -//go:linkname mallocgc runtime.mallocgc -//goland:noinspection GoUnusedParameter -func mallocgc(size uintptr, typ *rt.GoType, needzero bool) unsafe.Pointer - -//go:linkname makeslice runtime.makeslice -//goland:noinspection GoUnusedParameter -func makeslice(et *rt.GoType, len int, cap int) unsafe.Pointer - -//go:linkname makemap_small runtime.makemap_small -func makemap_small() unsafe.Pointer - -//go:linkname mapassign runtime.mapassign -//goland:noinspection GoUnusedParameter -func mapassign(t *rt.GoMapType, h unsafe.Pointer, k unsafe.Pointer) unsafe.Pointer - -//go:linkname mapassign_fast32 runtime.mapassign_fast32 -//goland:noinspection GoUnusedParameter -func mapassign_fast32(t *rt.GoMapType, h unsafe.Pointer, k uint32) unsafe.Pointer - -//go:linkname mapassign_fast64 runtime.mapassign_fast64 -//goland:noinspection GoUnusedParameter -func mapassign_fast64(t *rt.GoMapType, h unsafe.Pointer, k uint64) unsafe.Pointer - -//go:linkname mapassign_fast64ptr runtime.mapassign_fast64ptr -//goland:noinspection GoUnusedParameter -func mapassign_fast64ptr(t *rt.GoMapType, h unsafe.Pointer, k unsafe.Pointer) unsafe.Pointer - -//go:linkname mapassign_faststr runtime.mapassign_faststr -//goland:noinspection GoUnusedParameter -func mapassign_faststr(t *rt.GoMapType, h unsafe.Pointer, s string) unsafe.Pointer - -//go:nosplit -//go:linkname memclrHasPointers runtime.memclrHasPointers -//goland:noinspection GoUnusedParameter -func memclrHasPointers(ptr unsafe.Pointer, n uintptr) - -//go:noescape -//go:linkname memclrNoHeapPointers runtime.memclrNoHeapPointers -//goland:noinspection GoUnusedParameter -func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) |
