summaryrefslogtreecommitdiff
path: root/vendor/github.com/bytedance/sonic/internal/encoder
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/bytedance/sonic/internal/encoder')
-rw-r--r--vendor/github.com/bytedance/sonic/internal/encoder/asm_stubs_amd64_go116.go51
-rw-r--r--vendor/github.com/bytedance/sonic/internal/encoder/asm_stubs_amd64_go117.go51
-rw-r--r--vendor/github.com/bytedance/sonic/internal/encoder/asm_stubs_amd64_go121.go50
-rw-r--r--vendor/github.com/bytedance/sonic/internal/encoder/assembler_regabi_amd64.go (renamed from vendor/github.com/bytedance/sonic/internal/encoder/assembler_amd64_go117.go)33
-rw-r--r--vendor/github.com/bytedance/sonic/internal/encoder/assembler_stkabi_amd64.go (renamed from vendor/github.com/bytedance/sonic/internal/encoder/assembler_amd64_go116.go)34
-rw-r--r--vendor/github.com/bytedance/sonic/internal/encoder/debug_go116.go2
-rw-r--r--vendor/github.com/bytedance/sonic/internal/encoder/debug_go117.go4
-rw-r--r--vendor/github.com/bytedance/sonic/internal/encoder/encoder.go17
-rw-r--r--vendor/github.com/bytedance/sonic/internal/encoder/errors.go2
-rw-r--r--vendor/github.com/bytedance/sonic/internal/encoder/pools.go2
-rw-r--r--vendor/github.com/bytedance/sonic/internal/encoder/primitives.go8
-rw-r--r--vendor/github.com/bytedance/sonic/internal/encoder/stream.go2
-rw-r--r--vendor/github.com/bytedance/sonic/internal/encoder/stubs_go116.go2
-rw-r--r--vendor/github.com/bytedance/sonic/internal/encoder/stubs_go120.go4
-rw-r--r--vendor/github.com/bytedance/sonic/internal/encoder/stubs_go121.go66
15 files changed, 256 insertions, 72 deletions
diff --git a/vendor/github.com/bytedance/sonic/internal/encoder/asm_stubs_amd64_go116.go b/vendor/github.com/bytedance/sonic/internal/encoder/asm_stubs_amd64_go116.go
new file mode 100644
index 000000000..0a99f30ab
--- /dev/null
+++ b/vendor/github.com/bytedance/sonic/internal/encoder/asm_stubs_amd64_go116.go
@@ -0,0 +1,51 @@
+// +build go1.16,!go1.17
+
+// Copyright 2023 CloudWeGo Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package encoder
+
+import (
+ `strconv`
+
+ `github.com/bytedance/sonic/internal/jit`
+ `github.com/twitchyliquid64/golang-asm/obj`
+ `github.com/twitchyliquid64/golang-asm/obj/x86`
+)
+
+var (
+ _V_writeBarrier = jit.Imm(int64(_runtime_writeBarrier))
+
+ _F_gcWriteBarrierAX = jit.Func(gcWriteBarrierAX)
+)
+
+func (self *_Assembler) WritePtr(i int, ptr obj.Addr, rec obj.Addr) {
+ if rec.Reg == x86.REG_AX || rec.Index == x86.REG_AX {
+ panic("rec contains AX!")
+ }
+ self.Emit("MOVQ", _V_writeBarrier, _R10)
+ self.Emit("CMPL", jit.Ptr(_R10, 0), jit.Imm(0))
+ self.Sjmp("JE", "_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
+ self.Emit("MOVQ", ptr, _AX)
+ self.xsave(_DI)
+ self.Emit("LEAQ", rec, _DI)
+ self.Emit("MOVQ", _F_gcWriteBarrierAX, _R10) // MOVQ ${fn}, AX
+ self.Rjmp("CALL", _R10)
+ self.xload(_DI)
+ self.Sjmp("JMP", "_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
+ self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
+ self.Emit("MOVQ", ptr, rec)
+ self.Link("_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
+}
+
diff --git a/vendor/github.com/bytedance/sonic/internal/encoder/asm_stubs_amd64_go117.go b/vendor/github.com/bytedance/sonic/internal/encoder/asm_stubs_amd64_go117.go
new file mode 100644
index 000000000..5a3cf1a60
--- /dev/null
+++ b/vendor/github.com/bytedance/sonic/internal/encoder/asm_stubs_amd64_go117.go
@@ -0,0 +1,51 @@
+// +build go1.17,!go1.21
+
+// Copyright 2023 CloudWeGo Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package encoder
+
+import (
+ `strconv`
+ `unsafe`
+
+ `github.com/bytedance/sonic/internal/jit`
+ `github.com/twitchyliquid64/golang-asm/obj`
+ `github.com/twitchyliquid64/golang-asm/obj/x86`
+)
+
+var (
+ _V_writeBarrier = jit.Imm(int64(uintptr(unsafe.Pointer(&_runtime_writeBarrier))))
+
+ _F_gcWriteBarrierAX = jit.Func(gcWriteBarrierAX)
+)
+
+func (self *_Assembler) WritePtr(i int, ptr obj.Addr, rec obj.Addr) {
+ if rec.Reg == x86.REG_AX || rec.Index == x86.REG_AX {
+ panic("rec contains AX!")
+ }
+ self.Emit("MOVQ", _V_writeBarrier, _BX)
+ self.Emit("CMPL", jit.Ptr(_BX, 0), jit.Imm(0))
+ self.Sjmp("JE", "_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
+ self.xsave(_DI)
+ self.Emit("MOVQ", ptr, _AX)
+ self.Emit("LEAQ", rec, _DI)
+ self.Emit("MOVQ", _F_gcWriteBarrierAX, _BX) // MOVQ ${fn}, AX
+ self.Rjmp("CALL", _BX)
+ self.xload(_DI)
+ self.Sjmp("JMP", "_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
+ self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
+ self.Emit("MOVQ", ptr, rec)
+ self.Link("_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
+}
diff --git a/vendor/github.com/bytedance/sonic/internal/encoder/asm_stubs_amd64_go121.go b/vendor/github.com/bytedance/sonic/internal/encoder/asm_stubs_amd64_go121.go
new file mode 100644
index 000000000..2f9445ac4
--- /dev/null
+++ b/vendor/github.com/bytedance/sonic/internal/encoder/asm_stubs_amd64_go121.go
@@ -0,0 +1,50 @@
+// +build go1.21,!go1.22
+
+// Copyright 2023 CloudWeGo Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package encoder
+
+import (
+ `strconv`
+ `unsafe`
+
+ `github.com/bytedance/sonic/internal/jit`
+ `github.com/twitchyliquid64/golang-asm/obj`
+ `github.com/twitchyliquid64/golang-asm/obj/x86`
+)
+
+var (
+ _V_writeBarrier = jit.Imm(int64(uintptr(unsafe.Pointer(&_runtime_writeBarrier))))
+
+ _F_gcWriteBarrier2 = jit.Func(gcWriteBarrier2)
+)
+
+func (self *_Assembler) WritePtr(i int, ptr obj.Addr, old obj.Addr) {
+ if old.Reg == x86.REG_AX || old.Index == x86.REG_AX {
+ panic("rec contains AX!")
+ }
+ self.Emit("MOVQ", _V_writeBarrier, _BX)
+ self.Emit("CMPL", jit.Ptr(_BX, 0), jit.Imm(0))
+ self.Sjmp("JE", "_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
+ self.xsave(_SP_q)
+ self.Emit("MOVQ", _F_gcWriteBarrier2, _BX) // MOVQ ${fn}, AX
+ self.Rjmp("CALL", _BX)
+ self.Emit("MOVQ", ptr, jit.Ptr(_SP_q, 0))
+ self.Emit("MOVQ", old, _AX)
+ self.Emit("MOVQ", _AX, jit.Ptr(_SP_q, 8))
+ self.xload(_SP_q)
+ self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
+ self.Emit("MOVQ", ptr, old)
+}
diff --git a/vendor/github.com/bytedance/sonic/internal/encoder/assembler_amd64_go117.go b/vendor/github.com/bytedance/sonic/internal/encoder/assembler_regabi_amd64.go
index 1f1b28073..a89364b14 100644
--- a/vendor/github.com/bytedance/sonic/internal/encoder/assembler_amd64_go117.go
+++ b/vendor/github.com/bytedance/sonic/internal/encoder/assembler_regabi_amd64.go
@@ -1,5 +1,5 @@
-//go:build go1.17 && !go1.21
-// +build go1.17,!go1.21
+//go:build go1.17 && !go1.22
+// +build go1.17,!go1.22
/*
* Copyright 2021 ByteDance Inc.
@@ -435,8 +435,8 @@ func (self *_Assembler) save_state() {
self.Sjmp("JAE" , _LB_error_too_deep) // JA _error_too_deep
self.Emit("MOVQ", _SP_x, jit.Sib(_ST, _CX, 1, 8)) // MOVQ SP.x, 8(ST)(CX)
self.Emit("MOVQ", _SP_f, jit.Sib(_ST, _CX, 1, 16)) // MOVQ SP.f, 16(ST)(CX)
- self.WriteRecNotAX(0, _SP_p, jit.Sib(_ST, _CX, 1, 24)) // MOVQ SP.p, 24(ST)(CX)
- self.WriteRecNotAX(1, _SP_q, jit.Sib(_ST, _CX, 1, 32)) // MOVQ SP.q, 32(ST)(CX)
+ self.WritePtr(0, _SP_p, jit.Sib(_ST, _CX, 1, 24)) // MOVQ SP.p, 24(ST)(CX)
+ self.WritePtr(1, _SP_q, jit.Sib(_ST, _CX, 1, 32)) // MOVQ SP.q, 32(ST)(CX)
self.Emit("MOVQ", _R9, jit.Ptr(_ST, 0)) // MOVQ R9, (ST)
}
@@ -1175,28 +1175,3 @@ func (self *_Assembler) print_gc(i int, p1 *_Instr, p2 *_Instr) {
self.Emit("MOVQ", jit.Imm(int64(i)), _AX) // MOVQ $(i), CX
self.call_go(_F_println)
}
-
-var (
- _V_writeBarrier = jit.Imm(int64(uintptr(unsafe.Pointer(&_runtime_writeBarrier))))
-
- _F_gcWriteBarrierAX = jit.Func(gcWriteBarrierAX)
-)
-
-func (self *_Assembler) WriteRecNotAX(i int, ptr obj.Addr, rec obj.Addr) {
- if rec.Reg == x86.REG_AX || rec.Index == x86.REG_AX {
- panic("rec contains AX!")
- }
- self.Emit("MOVQ", _V_writeBarrier, _BX)
- self.Emit("CMPL", jit.Ptr(_BX, 0), jit.Imm(0))
- self.Sjmp("JE", "_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
- self.xsave(_DI)
- self.Emit("MOVQ", ptr, _AX)
- self.Emit("LEAQ", rec, _DI)
- self.Emit("MOVQ", _F_gcWriteBarrierAX, _BX) // MOVQ ${fn}, AX
- self.Rjmp("CALL", _BX)
- self.xload(_DI)
- self.Sjmp("JMP", "_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
- self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
- self.Emit("MOVQ", ptr, rec)
- self.Link("_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
-} \ No newline at end of file
diff --git a/vendor/github.com/bytedance/sonic/internal/encoder/assembler_amd64_go116.go b/vendor/github.com/bytedance/sonic/internal/encoder/assembler_stkabi_amd64.go
index d056259f2..89dafc84e 100644
--- a/vendor/github.com/bytedance/sonic/internal/encoder/assembler_amd64_go116.go
+++ b/vendor/github.com/bytedance/sonic/internal/encoder/assembler_stkabi_amd64.go
@@ -1,4 +1,4 @@
-// +build go1.15,!go1.17
+// +build go1.16,!go1.17
/*
* Copyright 2021 ByteDance Inc.
@@ -421,8 +421,8 @@ func (self *_Assembler) save_state() {
self.Sjmp("JAE" , _LB_error_too_deep) // JA _error_too_deep
self.Emit("MOVQ", _SP_x, jit.Sib(_ST, _CX, 1, 8)) // MOVQ SP.x, 8(ST)(CX)
self.Emit("MOVQ", _SP_f, jit.Sib(_ST, _CX, 1, 16)) // MOVQ SP.f, 16(ST)(CX)
- self.WriteRecNotAX(0, _SP_p, jit.Sib(_ST, _CX, 1, 24)) // MOVQ SP.p, 24(ST)(CX)
- self.WriteRecNotAX(1, _SP_q, jit.Sib(_ST, _CX, 1, 32)) // MOVQ SP.q, 32(ST)(CX)
+ self.WritePtr(0, _SP_p, jit.Sib(_ST, _CX, 1, 24)) // MOVQ SP.p, 24(ST)(CX)
+ self.WritePtr(1, _SP_q, jit.Sib(_ST, _CX, 1, 32)) // MOVQ SP.q, 32(ST)(CX)
self.Emit("MOVQ", _R8, jit.Ptr(_ST, 0)) // MOVQ R8, (ST)
}
@@ -579,7 +579,8 @@ var (
func (self *_Assembler) more_space() {
self.Link(_LB_more_space)
- self.Emit("MOVQ", _T_byte, jit.Ptr(_SP, 0)) // MOVQ $_T_byte, (SP)
+ self.Emit("MOVQ", _T_byte, _AX) // MOVQ $_T_byte, _AX
+ self.Emit("MOVQ", _AX, jit.Ptr(_SP, 0)) // MOVQ _AX, (SP)
self.Emit("MOVQ", _RP, jit.Ptr(_SP, 8)) // MOVQ RP, 8(SP)
self.Emit("MOVQ", _RL, jit.Ptr(_SP, 16)) // MOVQ RL, 16(SP)
self.Emit("MOVQ", _RC, jit.Ptr(_SP, 24)) // MOVQ RC, 24(SP)
@@ -1172,28 +1173,3 @@ func (self *_Assembler) print_gc(i int, p1 *_Instr, p2 *_Instr) {
self.Emit("MOVQ", jit.Imm(int64(i)), jit.Ptr(_SP, 0)) // MOVQ $(i), (SP)
self.call_go(_F_println)
}
-
-var (
- _V_writeBarrier = jit.Imm(int64(_runtime_writeBarrier))
-
- _F_gcWriteBarrierAX = jit.Func(gcWriteBarrierAX)
-)
-
-func (self *_Assembler) WriteRecNotAX(i int, ptr obj.Addr, rec obj.Addr) {
- if rec.Reg == x86.REG_AX || rec.Index == x86.REG_AX {
- panic("rec contains AX!")
- }
- self.Emit("MOVQ", _V_writeBarrier, _R10)
- self.Emit("CMPL", jit.Ptr(_R10, 0), jit.Imm(0))
- self.Sjmp("JE", "_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
- self.Emit("MOVQ", ptr, _AX)
- self.xsave(_DI)
- self.Emit("LEAQ", rec, _DI)
- self.Emit("MOVQ", _F_gcWriteBarrierAX, _R10) // MOVQ ${fn}, AX
- self.Rjmp("CALL", _R10)
- self.xload(_DI)
- self.Sjmp("JMP", "_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
- self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
- self.Emit("MOVQ", ptr, rec)
- self.Link("_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
-} \ No newline at end of file
diff --git a/vendor/github.com/bytedance/sonic/internal/encoder/debug_go116.go b/vendor/github.com/bytedance/sonic/internal/encoder/debug_go116.go
index 4bc9c15c1..d8d0c45cc 100644
--- a/vendor/github.com/bytedance/sonic/internal/encoder/debug_go116.go
+++ b/vendor/github.com/bytedance/sonic/internal/encoder/debug_go116.go
@@ -1,4 +1,4 @@
-// +build go1.15,!go1.17
+// +build go1.16,!go1.17
/*
* Copyright 2021 ByteDance Inc.
diff --git a/vendor/github.com/bytedance/sonic/internal/encoder/debug_go117.go b/vendor/github.com/bytedance/sonic/internal/encoder/debug_go117.go
index e1016de32..56a6cbf5e 100644
--- a/vendor/github.com/bytedance/sonic/internal/encoder/debug_go117.go
+++ b/vendor/github.com/bytedance/sonic/internal/encoder/debug_go117.go
@@ -1,4 +1,4 @@
-// +build go1.17,!go1.21
+// +build go1.17,!go1.22
/*
* Copyright 2021 ByteDance Inc.
@@ -202,4 +202,4 @@ func (self *_Assembler) print_ptr(i int, ptr obj.Addr, lea bool) {
self.Emit("MOVQ", _R10, _BX)
self.dcall(_F_printptr)
self.dload(_REG_debug...)
-} \ No newline at end of file
+}
diff --git a/vendor/github.com/bytedance/sonic/internal/encoder/encoder.go b/vendor/github.com/bytedance/sonic/internal/encoder/encoder.go
index 3c46061a4..bd8bae357 100644
--- a/vendor/github.com/bytedance/sonic/internal/encoder/encoder.go
+++ b/vendor/github.com/bytedance/sonic/internal/encoder/encoder.go
@@ -40,6 +40,7 @@ const (
bitNoQuoteTextMarshaler
bitNoNullSliceOrMap
bitValidateString
+ bitNoValidateJSONMarshaler
// used for recursive compile
bitPointerValue = 63
@@ -71,6 +72,10 @@ const (
// ValidateString indicates that encoder should validate the input string
// before encoding it into JSON.
ValidateString Options = 1 << bitValidateString
+
+ // NoValidateJSONMarshaler indicates that the encoder should not validate the output string
+ // after encoding the JSONMarshaler to JSON.
+ NoValidateJSONMarshaler Options = 1 << bitNoValidateJSONMarshaler
// CompatibleWithStd is used to be compatible with std encoder.
CompatibleWithStd Options = SortMapKeys | EscapeHTML | CompactMarshaler
@@ -115,6 +120,15 @@ func (self *Encoder) SetValidateString(f bool) {
}
}
+// SetNoValidateJSONMarshaler specifies if option NoValidateJSONMarshaler opens
+func (self *Encoder) SetNoValidateJSONMarshaler(f bool) {
+ if f {
+ self.Opts |= NoValidateJSONMarshaler
+ } else {
+ self.Opts &= ^NoValidateJSONMarshaler
+ }
+}
+
// SetCompactMarshaler specifies if option CompactMarshaler opens
func (self *Encoder) SetCompactMarshaler(f bool) {
if f {
@@ -292,7 +306,6 @@ func Pretouch(vt reflect.Type, opts ...option.CompileOption) error {
cfg := option.DefaultCompileOptions()
for _, opt := range opts {
opt(&cfg)
- break
}
return pretouchRec(map[reflect.Type]uint8{vt: 0}, cfg)
}
@@ -325,4 +338,4 @@ func Valid(data []byte) (ok bool, start int) {
}
return true, ret
-} \ No newline at end of file
+}
diff --git a/vendor/github.com/bytedance/sonic/internal/encoder/errors.go b/vendor/github.com/bytedance/sonic/internal/encoder/errors.go
index ac6848a5b..6e9d0c783 100644
--- a/vendor/github.com/bytedance/sonic/internal/encoder/errors.go
+++ b/vendor/github.com/bytedance/sonic/internal/encoder/errors.go
@@ -62,4 +62,4 @@ func goPanic(code int, val unsafe.Pointer) {
default:
panic("encoder error!")
}
-} \ No newline at end of file
+}
diff --git a/vendor/github.com/bytedance/sonic/internal/encoder/pools.go b/vendor/github.com/bytedance/sonic/internal/encoder/pools.go
index 9892ba11b..a2800ddef 100644
--- a/vendor/github.com/bytedance/sonic/internal/encoder/pools.go
+++ b/vendor/github.com/bytedance/sonic/internal/encoder/pools.go
@@ -190,4 +190,4 @@ func pretouchRec(vtm map[reflect.Type]uint8, opts option.CompileOptions) error {
}
opts.RecursiveDepth -= 1
return pretouchRec(next, opts)
-} \ No newline at end of file
+}
diff --git a/vendor/github.com/bytedance/sonic/internal/encoder/primitives.go b/vendor/github.com/bytedance/sonic/internal/encoder/primitives.go
index 78fb29ff6..0e47987c7 100644
--- a/vendor/github.com/bytedance/sonic/internal/encoder/primitives.go
+++ b/vendor/github.com/bytedance/sonic/internal/encoder/primitives.go
@@ -93,8 +93,10 @@ func encodeJsonMarshaler(buf *[]byte, val json.Marshaler, opt Options) error {
if opt & CompactMarshaler != 0 {
return compact(buf, ret)
}
- if ok, s := Valid(ret); !ok {
- return error_marshaler(ret, s)
+ if opt & NoValidateJSONMarshaler == 0 {
+ if ok, s := Valid(ret); !ok {
+ return error_marshaler(ret, s)
+ }
}
*buf = append(*buf, ret...)
return nil
@@ -165,4 +167,4 @@ func asJson(v unsafe.Pointer) (string, error) {
text := assertI2I(_T_json_Marshaler, *(*rt.GoIface)(v))
r, e := (*(*json.Marshaler)(unsafe.Pointer(&text))).MarshalJSON()
return rt.Mem2Str(r), e
-} \ No newline at end of file
+}
diff --git a/vendor/github.com/bytedance/sonic/internal/encoder/stream.go b/vendor/github.com/bytedance/sonic/internal/encoder/stream.go
index 8f73a2bf0..b6f3ce5fb 100644
--- a/vendor/github.com/bytedance/sonic/internal/encoder/stream.go
+++ b/vendor/github.com/bytedance/sonic/internal/encoder/stream.go
@@ -81,4 +81,4 @@ func (enc *StreamEncoder) Encode(val interface{}) (err error) {
free_bytes:
freeBytes(out)
return err
-} \ No newline at end of file
+}
diff --git a/vendor/github.com/bytedance/sonic/internal/encoder/stubs_go116.go b/vendor/github.com/bytedance/sonic/internal/encoder/stubs_go116.go
index 40d06f4af..5577c58d7 100644
--- a/vendor/github.com/bytedance/sonic/internal/encoder/stubs_go116.go
+++ b/vendor/github.com/bytedance/sonic/internal/encoder/stubs_go116.go
@@ -1,4 +1,4 @@
-// +build go1.15,!go1.17
+// +build go1.16,!go1.17
/*
* Copyright 2021 ByteDance Inc.
diff --git a/vendor/github.com/bytedance/sonic/internal/encoder/stubs_go120.go b/vendor/github.com/bytedance/sonic/internal/encoder/stubs_go120.go
index f1a7d10c7..94a2c0f56 100644
--- a/vendor/github.com/bytedance/sonic/internal/encoder/stubs_go120.go
+++ b/vendor/github.com/bytedance/sonic/internal/encoder/stubs_go120.go
@@ -1,4 +1,4 @@
-// +build go1.20
+// +build go1.20,!go1.21
/*
* Copyright 2021 ByteDance Inc.
@@ -63,4 +63,4 @@ func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
var _runtime_writeBarrier uintptr
//go:linkname gcWriteBarrierAX runtime.gcWriteBarrier
-func gcWriteBarrierAX() \ No newline at end of file
+func gcWriteBarrierAX()
diff --git a/vendor/github.com/bytedance/sonic/internal/encoder/stubs_go121.go b/vendor/github.com/bytedance/sonic/internal/encoder/stubs_go121.go
new file mode 100644
index 000000000..e194fbbf3
--- /dev/null
+++ b/vendor/github.com/bytedance/sonic/internal/encoder/stubs_go121.go
@@ -0,0 +1,66 @@
+// +build go1.21
+
+/*
+ * 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 encoder
+
+import (
+ `unsafe`
+
+ _ `github.com/chenzhuoyu/base64x`
+
+ `github.com/bytedance/sonic/internal/rt`
+)
+
+//go:linkname _subr__b64encode github.com/chenzhuoyu/base64x._subr__b64encode
+var _subr__b64encode uintptr
+
+//go:noescape
+//go:linkname memmove runtime.memmove
+//goland:noinspection GoUnusedParameter
+func memmove(to unsafe.Pointer, from unsafe.Pointer, n uintptr)
+
+//go:linkname growslice reflect.growslice
+//goland:noinspection GoUnusedParameter
+func growslice(et *rt.GoType, old rt.GoSlice, cap int) rt.GoSlice
+
+//go:linkname assertI2I runtime.assertI2I2
+//goland:noinspection GoUnusedParameter
+func assertI2I(inter *rt.GoType, i rt.GoIface) rt.GoIface
+
+//go:linkname mapiternext runtime.mapiternext
+//goland:noinspection GoUnusedParameter
+func mapiternext(it *rt.GoMapIterator)
+
+//go:linkname mapiterinit runtime.mapiterinit
+//goland:noinspection GoUnusedParameter
+func mapiterinit(t *rt.GoMapType, m *rt.GoMap, it *rt.GoMapIterator)
+
+//go:linkname isValidNumber encoding/json.isValidNumber
+//goland:noinspection GoUnusedParameter
+func isValidNumber(s string) bool
+
+//go:noescape
+//go:linkname memclrNoHeapPointers runtime.memclrNoHeapPointers
+//goland:noinspection GoUnusedParameter
+func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
+
+//go:linkname _runtime_writeBarrier runtime.writeBarrier
+var _runtime_writeBarrier uintptr
+
+//go:linkname gcWriteBarrier2 runtime.gcWriteBarrier2
+func gcWriteBarrier2()