summaryrefslogtreecommitdiff
path: root/vendor/github.com/bytedance/sonic/internal/encoder/ir/op.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2025-04-14 09:43:56 +0200
committerLibravatar GitHub <noreply@github.com>2025-04-14 09:43:56 +0200
commit51b9ef5c346f333e558eca38fd954464322f3b7d (patch)
treebf5cd0de887a27c1afc66345b1a464921d96e503 /vendor/github.com/bytedance/sonic/internal/encoder/ir/op.go
parent[docs] Remind the user that password resets don't work without restarting. (#... (diff)
downloadgotosocial-51b9ef5c346f333e558eca38fd954464322f3b7d.tar.xz
[chore]: Bump github.com/gin-contrib/gzip from 1.2.2 to 1.2.3 (#4000)
Bumps [github.com/gin-contrib/gzip](https://github.com/gin-contrib/gzip) from 1.2.2 to 1.2.3. - [Release notes](https://github.com/gin-contrib/gzip/releases) - [Changelog](https://github.com/gin-contrib/gzip/blob/master/.goreleaser.yaml) - [Commits](https://github.com/gin-contrib/gzip/compare/v1.2.2...v1.2.3) --- updated-dependencies: - dependency-name: github.com/gin-contrib/gzip dependency-version: 1.2.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/bytedance/sonic/internal/encoder/ir/op.go')
-rw-r--r--vendor/github.com/bytedance/sonic/internal/encoder/ir/op.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/github.com/bytedance/sonic/internal/encoder/ir/op.go b/vendor/github.com/bytedance/sonic/internal/encoder/ir/op.go
index a0c693f00..fe5a4ebe7 100644
--- a/vendor/github.com/bytedance/sonic/internal/encoder/ir/op.go
+++ b/vendor/github.com/bytedance/sonic/internal/encoder/ir/op.go
@@ -24,6 +24,7 @@ import (
"unsafe"
"github.com/bytedance/sonic/internal/encoder/vars"
+ "github.com/bytedance/sonic/internal/resolver"
"github.com/bytedance/sonic/internal/rt"
)
@@ -80,6 +81,8 @@ const (
OP_marshal_text_p
OP_cond_set
OP_cond_testc
+ OP_unsupported
+ OP_is_zero
)
const (
@@ -141,6 +144,7 @@ var OpNames = [256]string{
OP_marshal_text_p: "marshal_text_p",
OP_cond_set: "cond_set",
OP_cond_testc: "cond_testc",
+ OP_unsupported: "unsupported type",
}
func (self Op) String() string {
@@ -229,6 +233,11 @@ type typAndTab struct {
itab *rt.GoItab
}
+type typAndField struct {
+ vt reflect.Type
+ fv *resolver.FieldMeta
+}
+
func NewInsVtab(op Op, vt reflect.Type, itab *rt.GoItab) Instr {
return Instr{
o: op,
@@ -239,6 +248,13 @@ func NewInsVtab(op Op, vt reflect.Type, itab *rt.GoItab) Instr {
}
}
+func NewInsField(op Op, fv *resolver.FieldMeta) Instr {
+ return Instr{
+ o: op,
+ p: unsafe.Pointer(fv),
+ }
+}
+
func NewInsVp(op Op, vt reflect.Type, pv bool) Instr {
i := 0
if pv {
@@ -263,6 +279,10 @@ func (self Instr) Vf() uint8 {
return (*rt.GoType)(self.p).KindFlags
}
+func (self Instr) VField() (*resolver.FieldMeta) {
+ return (*resolver.FieldMeta)(self.p)
+}
+
func (self Instr) Vs() (v string) {
(*rt.GoString)(unsafe.Pointer(&v)).Ptr = self.p
(*rt.GoString)(unsafe.Pointer(&v)).Len = self.Vi()
@@ -273,6 +293,10 @@ func (self Instr) Vk() reflect.Kind {
return (*rt.GoType)(self.p).Kind()
}
+func (self Instr) GoType() *rt.GoType {
+ return (*rt.GoType)(self.p)
+}
+
func (self Instr) Vt() reflect.Type {
return (*rt.GoType)(self.p).Pack()
}
@@ -442,6 +466,10 @@ func (self *Program) Vtab(op Op, vt reflect.Type, itab *rt.GoItab) {
*self = append(*self, NewInsVtab(op, vt, itab))
}
+func (self *Program) VField(op Op, fv *resolver.FieldMeta) {
+ *self = append(*self, NewInsField(op, fv))
+}
+
func (self Program) Disassemble() string {
nb := len(self)
tab := make([]bool, nb+1)