From 7cf15fc56c255e6bb907decbcffaf617b778fda1 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Sat, 29 May 2021 14:47:18 +0900 Subject: [PATCH] Fix opcode layout - Adjust memory layout of the opcode to 128 bytes in a 64-bit environment --- encode.go | 24 +- internal/cmd/generator/main.go | 2 +- internal/cmd/generator/vm.go.tmpl | 1544 ++++++++--------- internal/encoder/compiler.go | 210 ++- internal/encoder/compiler_norace.go | 22 +- internal/encoder/compiler_race.go | 23 +- internal/encoder/context.go | 12 +- internal/encoder/encode_opcode_test.go | 2 +- internal/encoder/encoder.go | 23 +- internal/encoder/int.go | 14 +- internal/encoder/opcode.go | 217 +-- internal/encoder/optype.go | 2 +- internal/encoder/vm/debug_vm.go | 2 +- internal/encoder/vm/util.go | 19 +- internal/encoder/vm/vm.go | 1544 ++++++++--------- internal/encoder/vm_escaped/debug_vm.go | 2 +- internal/encoder/vm_escaped/util.go | 21 +- internal/encoder/vm_escaped/vm.go | 1544 ++++++++--------- .../encoder/vm_escaped_indent/debug_vm.go | 2 +- internal/encoder/vm_escaped_indent/util.go | 23 +- internal/encoder/vm_escaped_indent/vm.go | 1544 ++++++++--------- internal/encoder/vm_indent/debug_vm.go | 2 +- internal/encoder/vm_indent/util.go | 21 +- internal/encoder/vm_indent/vm.go | 1544 ++++++++--------- size_test.go | 18 + 25 files changed, 4223 insertions(+), 4158 deletions(-) create mode 100644 size_test.go diff --git a/encode.go b/encode.go index c574be7..9dad513 100644 --- a/encode.go +++ b/encode.go @@ -179,7 +179,13 @@ func encode(ctx *encoder.RuntimeContext, v interface{}, opt EncodeOption) ([]byt } p := uintptr(header.ptr) - ctx.Init(p, codeSet.CodeLength) + var code *encoder.Opcode + if (opt & EncodeOptionHTMLEscape) != 0 { + code = codeSet.EscapeKeyCode + } else { + code = codeSet.NoescapeKeyCode + } + ctx.Init(code, p, codeSet.CodeLength) ctx.KeepRefs = append(ctx.KeepRefs, header.ptr) buf, err := encodeRunCode(ctx, b, codeSet, opt) @@ -206,8 +212,14 @@ func encodeNoEscape(ctx *encoder.RuntimeContext, v interface{}, opt EncodeOption return nil, err } + var code *encoder.Opcode + if (opt & EncodeOptionHTMLEscape) != 0 { + code = codeSet.EscapeKeyCode + } else { + code = codeSet.NoescapeKeyCode + } p := uintptr(header.ptr) - ctx.Init(p, codeSet.CodeLength) + ctx.Init(code, p, codeSet.CodeLength) buf, err := encodeRunCode(ctx, b, codeSet, opt) if err != nil { return nil, err @@ -233,8 +245,14 @@ func encodeIndent(ctx *encoder.RuntimeContext, v interface{}, prefix, indent str return nil, err } + var code *encoder.Opcode + if (opt & EncodeOptionHTMLEscape) != 0 { + code = codeSet.EscapeKeyCode + } else { + code = codeSet.NoescapeKeyCode + } p := uintptr(header.ptr) - ctx.Init(p, codeSet.CodeLength) + ctx.Init(code, p, codeSet.CodeLength) buf, err := encodeRunIndentCode(ctx, b, codeSet, prefix, indent, opt) ctx.KeepRefs = append(ctx.KeepRefs, header.ptr) diff --git a/internal/cmd/generator/main.go b/internal/cmd/generator/main.go index a3c9da9..e778be2 100644 --- a/internal/cmd/generator/main.go +++ b/internal/cmd/generator/main.go @@ -48,7 +48,7 @@ var opTypeStrings = [{{ .OpLen }}]string{ {{- end }} } -type OpType int +type OpType uint16 const ( {{- range $index, $type := .OpTypes }} diff --git a/internal/cmd/generator/vm.go.tmpl b/internal/cmd/generator/vm.go.tmpl index 9522364..7af9d3a 100644 --- a/internal/cmd/generator/vm.go.tmpl +++ b/internal/cmd/generator/vm.go.tmpl @@ -13,7 +13,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt recursiveLevel := 0 ptrOffset := uintptr(0) ctxptr := ctx.Ptr() - code := codeSet.Code + code := ctx.Code for { switch code.Op { @@ -212,7 +212,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next break } - if code.IsNilableType && code.Indirect { + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { p = ptrToPtr(p) } bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -239,7 +239,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next break } - if code.IsNilableType && code.Indirect { + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { p = ptrToPtr(p) } bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -285,8 +285,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if idx < length { b = appendArrayElemIndent(ctx, code, b) store(ctxptr, code.ElemIdx, idx) - data := load(ctxptr, code.HeadIdx) - size := code.Size + data := load(ctxptr, code.Idx) + size := uintptr(code.Size) code = code.Next store(ctxptr, code.Idx, data+idx*size) } else { @@ -323,11 +323,11 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpArrayElem: idx := load(ctxptr, code.ElemIdx) idx++ - if idx < code.Length { + if idx < uintptr(code.Length) { b = appendArrayElemIndent(ctx, code, b) store(ctxptr, code.ElemIdx, idx) - p := load(ctxptr, code.HeadIdx) - size := code.Size + p := load(ctxptr, code.Idx) + size := uintptr(code.Size) code = code.Next store(ctxptr, code.Idx, p+idx*size) } else { @@ -508,7 +508,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHead: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -519,27 +519,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHead: p := load(ctxptr, code.Idx) - if p == 0 && (code.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if !code.AnonymousKey && len(code.Key) > 0 { + if (code.Flags&encoder.AnonymousKeyFlags) == 0 && len(code.Key) > 0 { b = appendStructKey(ctx, code, b) } - p += code.Offset + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmpty: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -550,19 +550,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmpty: p := load(ctxptr, code.Idx) - if p == 0 && (code.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - p += code.Offset - if p == 0 || (ptrToPtr(p) == 0 && code.IsNextOpPtrType) { + p += uintptr(code.Offset) + if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -570,10 +570,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, p) } case encoder.OpStructPtrHeadInt: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -586,25 +586,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadInt: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyInt: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -617,18 +617,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyInt: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -638,10 +638,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadIntString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -654,27 +654,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadIntString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -687,18 +687,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyIntString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -712,7 +712,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadIntPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -723,20 +723,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadIntPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -748,7 +748,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyIntPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -759,19 +759,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyIntPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -782,7 +782,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -793,20 +793,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadIntPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -820,7 +820,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -831,19 +831,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -854,10 +854,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadUint: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -870,25 +870,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadUint: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUint: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -901,18 +901,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyUint: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -922,10 +922,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadUintString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -938,27 +938,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadUintString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -971,18 +971,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyUintString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -996,7 +996,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadUintPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1007,20 +1007,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadUintPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1032,7 +1032,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyUintPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1043,19 +1043,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyUintPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1066,7 +1066,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1077,20 +1077,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadUintPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1104,7 +1104,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1115,19 +1115,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1138,10 +1138,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadFloat32: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1154,25 +1154,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat32: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1185,17 +1185,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat32: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat32(p + code.Offset) + v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1205,10 +1205,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadFloat32String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1221,27 +1221,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat32String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1254,17 +1254,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat32String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat32(p + code.Offset) + v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1278,7 +1278,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1289,20 +1289,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat32Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1314,7 +1314,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1325,19 +1325,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1348,7 +1348,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1359,20 +1359,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat32PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1386,7 +1386,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1397,19 +1397,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1420,10 +1420,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadFloat64: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1436,18 +1436,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat64: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) @@ -1455,10 +1455,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1471,17 +1471,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat64: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1494,10 +1494,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadFloat64String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1510,17 +1510,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat64String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -1531,10 +1531,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1547,17 +1547,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat64String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1574,7 +1574,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1585,20 +1585,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat64Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1614,7 +1614,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1625,19 +1625,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1652,7 +1652,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1663,20 +1663,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat64PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1694,7 +1694,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1705,19 +1705,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1732,10 +1732,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1748,25 +1748,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) + b = appendString(b, ptrToString(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1779,17 +1779,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToString(p + code.Offset) + v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -1799,10 +1799,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadStringString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1815,25 +1815,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadStringString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p+code.Offset)))) + b = appendString(b, string(appendString([]byte{}, ptrToString(p+uintptr(code.Offset))))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyStringString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1846,17 +1846,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyStringString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToString(p + code.Offset) + v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -1868,7 +1868,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadStringPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1879,20 +1879,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadStringPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1904,7 +1904,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyStringPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1915,19 +1915,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyStringPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1938,7 +1938,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1949,20 +1949,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadStringPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1974,7 +1974,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1985,19 +1985,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2006,10 +2006,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadBool: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2022,25 +2022,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBool: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBool: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2053,17 +2053,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBool: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToBool(p + code.Offset) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = appendBool(b, v) @@ -2073,10 +2073,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.NextField } case encoder.OpStructPtrHeadBoolString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2089,27 +2089,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBoolString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2122,17 +2122,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBoolString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToBool(p + code.Offset) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -2146,7 +2146,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadBoolPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2157,20 +2157,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBoolPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2182,7 +2182,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2193,19 +2193,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2216,7 +2216,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2227,20 +2227,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBoolPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2254,7 +2254,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2265,19 +2265,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2288,10 +2288,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadBytes: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2304,25 +2304,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBytes: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) + b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBytes: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2335,17 +2335,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBytes: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToBytes(p + code.Offset) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) == 0 { code = code.NextField } else { @@ -2357,7 +2357,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2368,20 +2368,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBytesPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2393,7 +2393,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2404,19 +2404,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2425,10 +2425,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadNumber: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2441,28 +2441,28 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadNumber: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = appendComma(bb) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumber: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2475,17 +2475,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyNumber: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToNumber(p + code.Offset) + v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -2498,10 +2498,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadNumberString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2514,19 +2514,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadNumberString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -2534,10 +2534,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2550,17 +2550,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyNumberString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToNumber(p + code.Offset) + v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -2577,7 +2577,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2588,20 +2588,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadNumberPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2617,7 +2617,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2628,19 +2628,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2654,7 +2654,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2665,20 +2665,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadNumberPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2695,7 +2695,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2706,19 +2706,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2732,10 +2732,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2748,25 +2748,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadArray, encoder.OpStructHeadSlice: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - p += code.Offset + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmptyArray: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2779,25 +2779,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyArray: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - p += code.Offset + p += uintptr(code.Offset) b = appendStructKey(ctx, code, b) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmptySlice: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2810,17 +2810,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptySlice: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - p += code.Offset + p += uintptr(code.Offset) slice := ptrToSlice(p) if slice.Len == 0 { code = code.NextField @@ -2832,7 +2832,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2843,20 +2843,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2869,7 +2869,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyArrayPtr, encoder.OpStructPtrHeadOmitEmptySlicePtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2880,19 +2880,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyArrayPtr, encoder.OpStructHeadOmitEmptySlicePtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { code = code.NextField @@ -2904,7 +2904,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMap: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2915,27 +2915,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMap: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if p != 0 && code.Indirect { - p = ptrToPtr(p + code.Offset) + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) } code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmptyMap: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2946,19 +2946,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMap: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if p != 0 && code.Indirect { - p = ptrToPtr(p + code.Offset) + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) } if maplen(ptrToUnsafePtr(p)) == 0 { code = code.NextField @@ -2970,7 +2970,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMapPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2981,15 +2981,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMapPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) @@ -2999,13 +2999,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.NextField break } - p = ptrToPtr(p + code.Offset) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 { b = appendNull(b) b = appendComma(b) code = code.NextField } else { - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p, code.PtrNum) } code = code.Next @@ -3014,7 +3014,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMapPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3025,26 +3025,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMapPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } if p == 0 { code = code.NextField break } - p = ptrToPtr(p + code.Offset) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 { code = code.NextField } else { - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p, code.PtrNum) } b = appendStructKey(ctx, code, b) @@ -3054,37 +3054,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadMarshalJSON: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadMarshalJSON { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -3098,37 +3098,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { + p = ptrToPtr(p + uintptr(code.Offset)) } } iface := ptrToInterface(code, p) - if code.Nilcheck && encoder.IsNilForMarshaler(iface) { + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -3143,7 +3143,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3154,20 +3154,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -3183,7 +3183,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3194,18 +3194,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } if p == 0 { @@ -3223,37 +3223,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalText: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadMarshalText: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadMarshalText { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -3267,36 +3267,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -3311,7 +3311,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3322,20 +3322,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMarshalTextPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -3351,7 +3351,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3362,18 +3362,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } if p == 0 { @@ -3389,16 +3389,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructField: - if !code.AnonymousKey { + if code.Flags&encoder.AnonymousKeyFlags == 0 { b = appendStructKey(ctx, code, b) } - p := load(ctxptr, code.HeadIdx) + code.Offset + p := load(ctxptr, code.Idx) + uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmpty: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if ptrToPtr(p) == 0 && code.IsNextOpPtrType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -3406,15 +3406,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, p) } case encoder.OpStructFieldInt: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyInt: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, u64, code) @@ -3422,17 +3422,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldIntString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyIntString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3442,8 +3442,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3453,8 +3453,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p), code) @@ -3462,8 +3462,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3475,8 +3475,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3486,15 +3486,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUint: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUint: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, u64, code) @@ -3502,17 +3502,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUintString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUintString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3522,8 +3522,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3533,8 +3533,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p), code) @@ -3542,8 +3542,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3555,8 +3555,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3566,14 +3566,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, v) @@ -3581,16 +3581,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32String: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3600,8 +3600,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3611,8 +3611,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, ptrToFloat32(p)) @@ -3620,8 +3620,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3633,8 +3633,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3644,9 +3644,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -3654,8 +3654,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -3666,8 +3666,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -3678,8 +3678,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -3692,8 +3692,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3709,8 +3709,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) v := ptrToFloat64(p) @@ -3722,8 +3722,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3739,8 +3739,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3754,14 +3754,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) + b = appendString(b, ptrToString(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, v) @@ -3769,15 +3769,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldStringString: - p := load(ctxptr, code.HeadIdx) - s := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + s := ptrToString(p + uintptr(code.Offset)) b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, s))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyStringString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, v))) @@ -3785,8 +3785,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3796,8 +3796,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, ptrToString(p)) @@ -3805,8 +3805,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3816,8 +3816,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) @@ -3825,14 +3825,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBool: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBool: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = appendBool(b, v) @@ -3840,16 +3840,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBoolString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolString: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3859,8 +3859,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3870,8 +3870,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendBool(b, ptrToBool(p)) @@ -3879,8 +3879,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3892,8 +3892,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3903,14 +3903,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBytes: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) + b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, v) @@ -3918,8 +3918,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3929,8 +3929,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, ptrToBytes(p)) @@ -3938,17 +3938,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumber: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = appendComma(bb) code = code.Next case encoder.OpStructFieldOmitEmptyNumber: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, v) @@ -3959,10 +3959,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumberString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -3970,8 +3970,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberString: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3984,8 +3984,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3999,8 +3999,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, ptrToNumber(p)) @@ -4011,8 +4011,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -4027,8 +4027,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4041,13 +4041,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldMarshalJSON: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p += code.Offset - if code.IsNilableType { + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -4059,17 +4059,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSON: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if code.IsNilableType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField break } iface := ptrToInterface(code, p) - if code.Nilcheck && encoder.IsNilForMarshaler(iface) { + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { code = code.NextField break } @@ -4081,9 +4081,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) code = code.Next case encoder.OpStructFieldMarshalJSONPtr: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4096,8 +4096,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSONPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -4108,13 +4108,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldMarshalText: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p += code.Offset - if code.IsNilableType { + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -4126,12 +4126,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalText: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if code.IsNilableType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField break } @@ -4143,9 +4143,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) code = code.Next case encoder.OpStructFieldMarshalTextPtr: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4158,8 +4158,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalTextPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -4171,25 +4171,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructFieldArray: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyArray: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldArrayPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyArrayPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) code = code.Next @@ -4199,13 +4199,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldSlice: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptySlice: - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) slice := ptrToSlice(p) if slice.Len == 0 { code = code.NextField @@ -4216,13 +4216,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldSlicePtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptySlicePtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) code = code.Next @@ -4232,13 +4232,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldMap: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyMap: - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 { code = code.NextField } else { @@ -4248,16 +4248,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldMapPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) if p != 0 { p = ptrToNPtr(p, code.PtrNum) } code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyMapPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) if p != 0 { p = ptrToNPtr(p, code.PtrNum) } @@ -4270,14 +4270,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldStruct: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyStruct: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if ptrToPtr(p) == 0 && code.IsNextOpPtrType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -4290,15 +4290,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEndSkipLast(ctx, code, b) code = code.Next case encoder.OpStructEndInt: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyInt: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, u64, code) @@ -4308,17 +4308,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndIntString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4331,8 +4331,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndIntPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4341,8 +4341,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p), code) @@ -4353,8 +4353,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndIntPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4365,8 +4365,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4378,15 +4378,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndUint: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUint: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, u64, code) @@ -4396,17 +4396,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndUintString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4419,8 +4419,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndUintPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4429,8 +4429,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p), code) @@ -4441,8 +4441,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndUintPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4453,8 +4453,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4466,14 +4466,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat32: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, v) @@ -4483,16 +4483,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat32String: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4505,8 +4505,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat32Ptr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4515,8 +4515,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, ptrToFloat32(p)) @@ -4527,8 +4527,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat32PtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4539,8 +4539,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4552,8 +4552,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -4562,8 +4562,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -4576,8 +4576,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -4588,8 +4588,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -4605,8 +4605,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat64Ptr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) b = appendStructEnd(ctx, code, b) @@ -4621,8 +4621,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) v := ptrToFloat64(p) @@ -4637,8 +4637,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat64PtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4653,8 +4653,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) v := ptrToFloat64(p) @@ -4670,14 +4670,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) + b = appendString(b, ptrToString(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, v) @@ -4687,15 +4687,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndStringString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - s := ptrToString(p + code.Offset) + s := ptrToString(p + uintptr(code.Offset)) b = appendString(b, string(appendString([]byte{}, s))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, v))) @@ -4706,8 +4706,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndStringPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4716,8 +4716,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, ptrToString(p)) @@ -4728,8 +4728,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndStringPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4738,8 +4738,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) @@ -4749,14 +4749,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndBool: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBool: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = appendBool(b, v) @@ -4766,16 +4766,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndBoolString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBoolString: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4788,8 +4788,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBoolPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4798,8 +4798,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendBool(b, ptrToBool(p)) @@ -4810,8 +4810,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBoolPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4822,8 +4822,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4835,14 +4835,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndBytes: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) + b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, v) @@ -4853,8 +4853,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBytesPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4863,8 +4863,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, ptrToBytes(p)) @@ -4874,17 +4874,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndNumber: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = appendStructEnd(ctx, code, bb) code = code.Next case encoder.OpStructEndOmitEmptyNumber: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, v) @@ -4897,10 +4897,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndNumberString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -4908,8 +4908,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberString: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4925,8 +4925,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndNumberPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4939,8 +4939,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, ptrToNumber(p)) @@ -4954,8 +4954,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndNumberPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4969,8 +4969,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') diff --git a/internal/encoder/compiler.go b/internal/encoder/compiler.go index 486c80f..36b555e 100644 --- a/internal/encoder/compiler.go +++ b/internal/encoder/compiler.go @@ -55,19 +55,29 @@ func compileToGetCodeSetSlowPath(typeptr uintptr) (*OpcodeSet, error) { // noescape trick for header.typ ( reflect.*rtype ) copiedType := *(**runtime.Type)(unsafe.Pointer(&typeptr)) - code, err := compileHead(&compileContext{ + noescapeKeyCode, err := compileHead(&compileContext{ typ: copiedType, structTypeToCompiledCode: map[uintptr]*CompiledCode{}, }) if err != nil { return nil, err } - code = copyOpcode(code) - codeLength := code.TotalLength() + escapeKeyCode, err := compileHead(&compileContext{ + typ: copiedType, + structTypeToCompiledCode: map[uintptr]*CompiledCode{}, + escapeKey: true, + }) + if err != nil { + return nil, err + } + noescapeKeyCode = copyOpcode(noescapeKeyCode) + escapeKeyCode = copyOpcode(escapeKeyCode) + codeLength := noescapeKeyCode.TotalLength() codeSet := &OpcodeSet{ - Type: copiedType, - Code: code, - CodeLength: codeLength, + Type: copiedType, + NoescapeKeyCode: noescapeKeyCode, + EscapeKeyCode: escapeKeyCode, + CodeLength: codeLength, } storeOpcodeSet(typeptr, codeSet, opcodeMap) return codeSet, nil @@ -246,6 +256,7 @@ func linkRecursiveCode(c *Opcode) { continue } code.Jmp.Code = copyOpcode(code.Jmp.Code) + c := code.Jmp.Code c.End.Next = newEndOp(&compileContext{}) c.Op = c.Op.PtrHeadToHead() @@ -268,6 +279,7 @@ func linkRecursiveCode(c *Opcode) { code.Jmp.Linked = true linkRecursiveCode(code.Jmp.Code) + code = code.Next continue } @@ -518,9 +530,13 @@ func compileMarshalJSON(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpMarshalJSON) typ := ctx.typ if !typ.Implements(marshalJSONType) && runtime.PtrTo(typ).Implements(marshalJSONType) { - code.AddrForMarshaler = true + code.Flags |= AddrForMarshalerFlags + } + if isNilableType(typ) { + code.Flags |= IsNilableTypeFlags + } else { + code.Flags &= ^IsNilableTypeFlags } - code.IsNilableType = isNilableType(typ) ctx.incIndex() return code, nil } @@ -529,9 +545,13 @@ func compileMarshalText(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpMarshalText) typ := ctx.typ if !typ.Implements(marshalTextType) && runtime.PtrTo(typ).Implements(marshalTextType) { - code.AddrForMarshaler = true + code.Flags |= AddrForMarshalerFlags + } + if isNilableType(typ) { + code.Flags |= IsNilableTypeFlags + } else { + code.Flags &= ^IsNilableTypeFlags } - code.IsNilableType = isNilableType(typ) ctx.incIndex() return code, nil } @@ -540,7 +560,7 @@ const intSize = 32 << (^uint(0) >> 63) func compileInt(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpInt) - code.setMaskAndRshiftNum(intSize) + code.NumBitSize = intSize ctx.incIndex() return code, nil } @@ -556,7 +576,7 @@ func compileIntPtr(ctx *compileContext) (*Opcode, error) { func compileInt8(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpInt) - code.setMaskAndRshiftNum(8) + code.NumBitSize = 8 ctx.incIndex() return code, nil } @@ -572,7 +592,7 @@ func compileInt8Ptr(ctx *compileContext) (*Opcode, error) { func compileInt16(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpInt) - code.setMaskAndRshiftNum(16) + code.NumBitSize = 16 ctx.incIndex() return code, nil } @@ -588,7 +608,7 @@ func compileInt16Ptr(ctx *compileContext) (*Opcode, error) { func compileInt32(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpInt) - code.setMaskAndRshiftNum(32) + code.NumBitSize = 32 ctx.incIndex() return code, nil } @@ -604,7 +624,7 @@ func compileInt32Ptr(ctx *compileContext) (*Opcode, error) { func compileInt64(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpInt) - code.setMaskAndRshiftNum(64) + code.NumBitSize = 64 ctx.incIndex() return code, nil } @@ -620,7 +640,7 @@ func compileInt64Ptr(ctx *compileContext) (*Opcode, error) { func compileUint(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUint) - code.setMaskAndRshiftNum(intSize) + code.NumBitSize = intSize ctx.incIndex() return code, nil } @@ -636,7 +656,7 @@ func compileUintPtr(ctx *compileContext) (*Opcode, error) { func compileUint8(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUint) - code.setMaskAndRshiftNum(8) + code.NumBitSize = 8 ctx.incIndex() return code, nil } @@ -652,7 +672,7 @@ func compileUint8Ptr(ctx *compileContext) (*Opcode, error) { func compileUint16(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUint) - code.setMaskAndRshiftNum(16) + code.NumBitSize = 16 ctx.incIndex() return code, nil } @@ -668,7 +688,7 @@ func compileUint16Ptr(ctx *compileContext) (*Opcode, error) { func compileUint32(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUint) - code.setMaskAndRshiftNum(32) + code.NumBitSize = 32 ctx.incIndex() return code, nil } @@ -684,7 +704,7 @@ func compileUint32Ptr(ctx *compileContext) (*Opcode, error) { func compileUint64(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUint) - code.setMaskAndRshiftNum(64) + code.NumBitSize = 64 ctx.incIndex() return code, nil } @@ -700,70 +720,70 @@ func compileUint64Ptr(ctx *compileContext) (*Opcode, error) { func compileIntString(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpIntString) - code.setMaskAndRshiftNum(intSize) + code.NumBitSize = intSize ctx.incIndex() return code, nil } func compileInt8String(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpIntString) - code.setMaskAndRshiftNum(8) + code.NumBitSize = 8 ctx.incIndex() return code, nil } func compileInt16String(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpIntString) - code.setMaskAndRshiftNum(16) + code.NumBitSize = 16 ctx.incIndex() return code, nil } func compileInt32String(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpIntString) - code.setMaskAndRshiftNum(32) + code.NumBitSize = 32 ctx.incIndex() return code, nil } func compileInt64String(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpIntString) - code.setMaskAndRshiftNum(64) + code.NumBitSize = 64 ctx.incIndex() return code, nil } func compileUintString(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUintString) - code.setMaskAndRshiftNum(intSize) + code.NumBitSize = intSize ctx.incIndex() return code, nil } func compileUint8String(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUintString) - code.setMaskAndRshiftNum(8) + code.NumBitSize = 8 ctx.incIndex() return code, nil } func compileUint16String(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUintString) - code.setMaskAndRshiftNum(16) + code.NumBitSize = 16 ctx.incIndex() return code, nil } func compileUint32String(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUintString) - code.setMaskAndRshiftNum(32) + code.NumBitSize = 32 ctx.incIndex() return code, nil } func compileUint64String(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUintString) - code.setMaskAndRshiftNum(64) + code.NumBitSize = 64 ctx.incIndex() return code, nil } @@ -879,7 +899,7 @@ func compileSlice(ctx *compileContext) (*Opcode, error) { if err != nil { return nil, err } - code.Indirect = true + code.Flags |= IndirectFlags // header => opcode => elem => end // ^ | @@ -891,7 +911,6 @@ func compileSlice(ctx *compileContext) (*Opcode, error) { end := newOpCode(ctx, OpSliceEnd) ctx.incIndex() - header.Elem = elemCode header.End = end header.Next = code code.BeforeLastCode().Next = (*Opcode)(unsafe.Pointer(elemCode)) @@ -934,7 +953,7 @@ func compileArray(ctx *compileContext) (*Opcode, error) { if err != nil { return nil, err } - code.Indirect = true + code.Flags |= IndirectFlags // header => opcode => elem => end // ^ | // |________| @@ -945,7 +964,6 @@ func compileArray(ctx *compileContext) (*Opcode, error) { end := newOpCode(ctx, OpArrayEnd) ctx.incIndex() - header.Elem = elemCode header.End = end header.Next = code code.BeforeLastCode().Next = (*Opcode)(unsafe.Pointer(elemCode)) @@ -976,16 +994,13 @@ func compileMap(ctx *compileContext) (*Opcode, error) { if err != nil { return nil, err } - valueCode.Indirect = true + valueCode.Flags |= IndirectFlags key := newMapKeyCode(ctx, header) ctx.incIndex() ctx = ctx.decIndent() - header.MapKey = key - header.MapValue = value - end := newMapEndCode(ctx, header) ctx.incIndex() @@ -1052,8 +1067,7 @@ func compiledCode(ctx *compileContext) *Opcode { func structHeader(ctx *compileContext, fieldCode *Opcode, valueCode *Opcode, tag *runtime.StructTag) *Opcode { op := optimizeStructHeader(valueCode, tag) fieldCode.Op = op - fieldCode.Mask = valueCode.Mask - fieldCode.RshiftNum = valueCode.RshiftNum + fieldCode.NumBitSize = valueCode.NumBitSize fieldCode.PtrNum = valueCode.PtrNum if op.IsMultipleOpHead() { return valueCode.BeforeLastCode() @@ -1065,9 +1079,8 @@ func structHeader(ctx *compileContext, fieldCode *Opcode, valueCode *Opcode, tag func structField(ctx *compileContext, fieldCode *Opcode, valueCode *Opcode, tag *runtime.StructTag) *Opcode { op := optimizeStructField(valueCode, tag) fieldCode.Op = op + fieldCode.NumBitSize = valueCode.NumBitSize fieldCode.PtrNum = valueCode.PtrNum - fieldCode.Mask = valueCode.Mask - fieldCode.RshiftNum = valueCode.RshiftNum if op.IsMultipleOpField() { return valueCode.BeforeLastCode() } @@ -1082,7 +1095,7 @@ func isNotExistsField(head *Opcode) bool { if head.Op != OpStructHead { return false } - if !head.AnonymousHead { + if (head.Flags & AnonymousHeadFlags) == 0 { return false } if head.Next == nil { @@ -1117,7 +1130,7 @@ func optimizeAnonymousFields(head *Opcode) { if isNotExistsField(code.Next) { code.Next = code.NextField diff := code.Next.DisplayIdx - code.DisplayIdx - for i := 0; i < diff; i++ { + for i := uint32(0); i < diff; i++ { code.Next.decOpcodeIndex() } linkPrevToNextField(code, removedFields) @@ -1147,20 +1160,20 @@ func anonymousStructFieldPairMap(tags runtime.StructTags, named string, valueCod isHeadOp := strings.Contains(f.Op.String(), "Head") if existsKey && f.Next != nil && strings.Contains(f.Next.Op.String(), "Recursive") { // through - } else if isHeadOp && !f.AnonymousHead { + } else if isHeadOp && (f.Flags&AnonymousHeadFlags) == 0 { if existsKey { // TODO: need to remove this head f.Op = OpStructHead - f.AnonymousKey = true - f.AnonymousHead = true + f.Flags |= AnonymousKeyFlags + f.Flags |= AnonymousHeadFlags } else if named == "" { - f.AnonymousHead = true + f.Flags |= AnonymousHeadFlags } } else if named == "" && f.Op == OpStructEnd { f.Op = OpStructAnonymousEnd } else if existsKey { diff := f.NextField.DisplayIdx - f.DisplayIdx - for i := 0; i < diff; i++ { + for i := uint32(0); i < diff; i++ { f.NextField.decOpcodeIndex() } linkPrevToNextField(f, removedFields) @@ -1179,7 +1192,7 @@ func anonymousStructFieldPairMap(tags runtime.StructTags, named string, valueCod anonymousFields[key] = append(anonymousFields[key], structFieldPair{ prevField: prevAnonymousField, curField: f, - isTaggedKey: f.IsTaggedKey, + isTaggedKey: (f.Flags & IsTaggedKeyFlags) != 0, }) if f.Next != nil && f.NextField != f.Next && f.Next.Op.CodeType() == CodeStructField { for k, v := range anonymousFieldPairRecursively(named, f.Next) { @@ -1200,12 +1213,12 @@ func anonymousFieldPairRecursively(named string, valueCode *Opcode) map[string][ f := valueCode var prevAnonymousField *Opcode for { - if f.DisplayKey != "" && f.AnonymousHead { + if f.DisplayKey != "" && (f.Flags&AnonymousHeadFlags) != 0 { key := fmt.Sprintf("%s.%s", named, f.DisplayKey) anonymousFields[key] = append(anonymousFields[key], structFieldPair{ prevField: prevAnonymousField, curField: f, - isTaggedKey: f.IsTaggedKey, + isTaggedKey: (f.Flags & IsTaggedKeyFlags) != 0, }) if f.Next != nil && f.NextField != f.Next && f.Next.Op.CodeType() == CodeStructField { for k, v := range anonymousFieldPairRecursively(named, f.Next) { @@ -1238,11 +1251,11 @@ func optimizeConflictAnonymousFields(anonymousFields map[string][]structFieldPai if fieldPair.prevField == nil { // head operation fieldPair.curField.Op = OpStructHead - fieldPair.curField.AnonymousHead = true - fieldPair.curField.AnonymousKey = true + fieldPair.curField.Flags |= AnonymousHeadFlags + fieldPair.curField.Flags |= AnonymousKeyFlags } else { diff := fieldPair.curField.NextField.DisplayIdx - fieldPair.curField.DisplayIdx - for i := 0; i < diff; i++ { + for i := uint32(0); i < diff; i++ { fieldPair.curField.NextField.decOpcodeIndex() } removedFields[fieldPair.curField] = struct{}{} @@ -1258,12 +1271,12 @@ func optimizeConflictAnonymousFields(anonymousFields map[string][]structFieldPai if fieldPair.prevField == nil { // head operation fieldPair.curField.Op = OpStructHead - fieldPair.curField.AnonymousHead = true - fieldPair.curField.AnonymousKey = true + fieldPair.curField.Flags |= AnonymousHeadFlags + fieldPair.curField.Flags |= AnonymousKeyFlags } else { diff := fieldPair.curField.NextField.DisplayIdx - fieldPair.curField.DisplayIdx removedFields[fieldPair.curField] = struct{}{} - for i := 0; i < diff; i++ { + for i := uint32(0); i < diff; i++ { fieldPair.curField.NextField.decOpcodeIndex() } linkPrevToNextField(fieldPair.curField, removedFields) @@ -1273,7 +1286,7 @@ func optimizeConflictAnonymousFields(anonymousFields map[string][]structFieldPai } } else { for _, fieldPair := range taggedPairs { - fieldPair.curField.IsTaggedKey = false + fieldPair.curField.Flags &= ^IsTaggedKeyFlags } } } @@ -1402,46 +1415,68 @@ func compileStruct(ctx *compileContext, isPtr bool) (*Opcode, error) { // fix issue144 if !(isPtr && strings.Contains(valueCode.Op.String(), "Marshal")) { - valueCode.Indirect = indirect + if indirect { + valueCode.Flags |= IndirectFlags + } else { + valueCode.Flags &= ^IndirectFlags + } } } else { if indirect { // if parent is indirect type, set child indirect property to true - valueCode.Indirect = indirect + valueCode.Flags |= IndirectFlags } else { // if parent is not indirect type and child have only one field, set child indirect property to false if i == 0 && valueCode.NextField != nil && valueCode.NextField.Op == OpStructEnd { - valueCode.Indirect = indirect + valueCode.Flags &= ^IndirectFlags } } } - key := fmt.Sprintf(`"%s":`, tag.Key) - escapedKey := fmt.Sprintf(`%s:`, string(AppendEscapedString([]byte{}, tag.Key))) + var flags OpFlags + if indirect { + flags |= IndirectFlags + } + if field.Anonymous { + flags |= AnonymousKeyFlags + } + if tag.IsTaggedKey { + flags |= IsTaggedKeyFlags + } + if nilcheck { + flags |= NilCheckFlags + } + if addrForMarshaler { + flags |= AddrForMarshalerFlags + } + if strings.Contains(valueCode.Op.String(), "Ptr") || valueCode.Op == OpInterface { + flags |= IsNextOpPtrTypeFlags + } + if isNilableType { + flags |= IsNilableTypeFlags + } + var key string + if ctx.escapeKey { + key = fmt.Sprintf(`%s:`, string(AppendEscapedString([]byte{}, tag.Key))) + } else { + key = fmt.Sprintf(`"%s":`, tag.Key) + } fieldCode := &Opcode{ - Type: valueCode.Type, - DisplayIdx: fieldOpcodeIndex, - Idx: opcodeOffset(fieldPtrIndex), - Next: valueCode, - Indent: ctx.indent, - AnonymousKey: field.Anonymous, - Key: []byte(key), - EscapedKey: []byte(escapedKey), - IsTaggedKey: tag.IsTaggedKey, - DisplayKey: tag.Key, - Offset: field.Offset, - Indirect: indirect, - Nilcheck: nilcheck, - AddrForMarshaler: addrForMarshaler, - IsNextOpPtrType: strings.Contains(valueCode.Op.String(), "Ptr") || valueCode.Op == OpInterface, - IsNilableType: isNilableType, + Idx: opcodeOffset(fieldPtrIndex), + Next: valueCode, + Flags: flags, + Key: key, + Offset: uint32(field.Offset), + Type: valueCode.Type, + DisplayIdx: fieldOpcodeIndex, + Indent: ctx.indent, + DisplayKey: tag.Key, } if fieldIdx == 0 { - fieldCode.HeadIdx = fieldCode.Idx code = structHeader(ctx, fieldCode, valueCode, tag) head = fieldCode prevField = fieldCode } else { - fieldCode.HeadIdx = head.HeadIdx + fieldCode.Idx = head.Idx code.Next = fieldCode code = structField(ctx, fieldCode, valueCode, tag) prevField.NextField = fieldCode @@ -1453,9 +1488,9 @@ func compileStruct(ctx *compileContext, isPtr bool) (*Opcode, error) { structEndCode := &Opcode{ Op: OpStructEnd, + Next: newEndOp(ctx), Type: nil, Indent: ctx.indent, - Next: newEndOp(ctx), } ctx = ctx.decIndent() @@ -1464,12 +1499,11 @@ func compileStruct(ctx *compileContext, isPtr bool) (*Opcode, error) { if head == nil { head = &Opcode{ Op: OpStructHead, + Idx: opcodeOffset(ctx.ptrIndex), + NextField: structEndCode, Type: typ, DisplayIdx: ctx.opcodeIndex, - Idx: opcodeOffset(ctx.ptrIndex), - HeadIdx: opcodeOffset(ctx.ptrIndex), Indent: ctx.indent, - NextField: structEndCode, } structEndCode.PrevField = head ctx.incIndex() @@ -1494,8 +1528,8 @@ func compileStruct(ctx *compileContext, isPtr bool) (*Opcode, error) { delete(ctx.structTypeToCompiledCode, typeptr) - if !disableIndirectConversion && !head.Indirect && isPtr { - head.Indirect = true + if !disableIndirectConversion && (head.Flags&IndirectFlags == 0) && isPtr { + head.Flags |= IndirectFlags } return ret, nil diff --git a/internal/encoder/compiler_norace.go b/internal/encoder/compiler_norace.go index acc2658..e5e58d4 100644 --- a/internal/encoder/compiler_norace.go +++ b/internal/encoder/compiler_norace.go @@ -20,19 +20,29 @@ func CompileToGetCodeSet(typeptr uintptr) (*OpcodeSet, error) { // noescape trick for header.typ ( reflect.*rtype ) copiedType := *(**runtime.Type)(unsafe.Pointer(&typeptr)) - code, err := compileHead(&compileContext{ + noescapeKeyCode, err := compileHead(&compileContext{ typ: copiedType, structTypeToCompiledCode: map[uintptr]*CompiledCode{}, }) if err != nil { return nil, err } - code = copyOpcode(code) - codeLength := code.TotalLength() + escapeKeyCode, err := compileHead(&compileContext{ + typ: copiedType, + structTypeToCompiledCode: map[uintptr]*CompiledCode{}, + escapeKey: true, + }) + if err != nil { + return nil, err + } + noescapeKeyCode = copyOpcode(noescapeKeyCode) + escapeKeyCode = copyOpcode(escapeKeyCode) + codeLength := noescapeKeyCode.TotalLength() codeSet := &OpcodeSet{ - Type: copiedType, - Code: code, - CodeLength: codeLength, + Type: copiedType, + NoescapeKeyCode: noescapeKeyCode, + EscapeKeyCode: escapeKeyCode, + CodeLength: codeLength, } cachedOpcodeSets[index] = codeSet return codeSet, nil diff --git a/internal/encoder/compiler_race.go b/internal/encoder/compiler_race.go index 63b7733..a1d5f84 100644 --- a/internal/encoder/compiler_race.go +++ b/internal/encoder/compiler_race.go @@ -26,19 +26,30 @@ func CompileToGetCodeSet(typeptr uintptr) (*OpcodeSet, error) { // noescape trick for header.typ ( reflect.*rtype ) copiedType := *(**runtime.Type)(unsafe.Pointer(&typeptr)) - code, err := compileHead(&compileContext{ + noescapeKeyCode, err := compileHead(&compileContext{ typ: copiedType, structTypeToCompiledCode: map[uintptr]*CompiledCode{}, }) if err != nil { return nil, err } - code = copyOpcode(code) - codeLength := code.TotalLength() + escapeKeyCode, err := compileHead(&compileContext{ + typ: copiedType, + structTypeToCompiledCode: map[uintptr]*CompiledCode{}, + escapeKey: true, + }) + if err != nil { + return nil, err + } + + noescapeKeyCode = copyOpcode(noescapeKeyCode) + escapeKeyCode = copyOpcode(escapeKeyCode) + codeLength := noescapeKeyCode.TotalLength() codeSet := &OpcodeSet{ - Type: copiedType, - Code: code, - CodeLength: codeLength, + Type: copiedType, + NoescapeKeyCode: noescapeKeyCode, + EscapeKeyCode: escapeKeyCode, + CodeLength: codeLength, } setsMu.Lock() cachedOpcodeSets[index] = codeSet diff --git a/internal/encoder/context.go b/internal/encoder/context.go index d7e030e..2a81e7b 100644 --- a/internal/encoder/context.go +++ b/internal/encoder/context.go @@ -9,9 +9,10 @@ import ( type compileContext struct { typ *runtime.Type - opcodeIndex int + opcodeIndex uint32 ptrIndex int - indent int + indent uint32 + escapeKey bool structTypeToCompiledCode map[uintptr]*CompiledCode parent *compileContext @@ -23,6 +24,7 @@ func (c *compileContext) context() *compileContext { opcodeIndex: c.opcodeIndex, ptrIndex: c.ptrIndex, indent: c.indent, + escapeKey: c.escapeKey, structTypeToCompiledCode: c.structTypeToCompiledCode, parent: c, } @@ -106,12 +108,13 @@ type RuntimeContext struct { Ptrs []uintptr KeepRefs []unsafe.Pointer SeenPtr []uintptr - BaseIndent int + BaseIndent uint32 Prefix []byte IndentStr []byte + Code *Opcode } -func (c *RuntimeContext) Init(p uintptr, codelen int) { +func (c *RuntimeContext) Init(code *Opcode, p uintptr, codelen int) { if len(c.Ptrs) < codelen { c.Ptrs = make([]uintptr, codelen) } @@ -119,6 +122,7 @@ func (c *RuntimeContext) Init(p uintptr, codelen int) { c.KeepRefs = c.KeepRefs[:0] c.SeenPtr = c.SeenPtr[:0] c.BaseIndent = 0 + c.Code = code } func (c *RuntimeContext) Ptr() uintptr { diff --git a/internal/encoder/encode_opcode_test.go b/internal/encoder/encode_opcode_test.go index d37d747..b4260ba 100644 --- a/internal/encoder/encode_opcode_test.go +++ b/internal/encoder/encode_opcode_test.go @@ -14,5 +14,5 @@ func TestDumpOpcode(t *testing.T) { if err != nil { t.Fatal(err) } - codeSet.Code.Dump() + codeSet.EscapeKeyCode.Dump() } diff --git a/internal/encoder/encoder.go b/internal/encoder/encoder.go index ef6b910..2f9b6a7 100644 --- a/internal/encoder/encoder.go +++ b/internal/encoder/encoder.go @@ -102,9 +102,10 @@ func (t OpType) IsMultipleOpField() bool { } type OpcodeSet struct { - Type *runtime.Type - Code *Opcode - CodeLength int + Type *runtime.Type + NoescapeKeyCode *Opcode + EscapeKeyCode *Opcode + CodeLength int } type CompiledCode struct { @@ -362,7 +363,7 @@ func AppendNumber(b []byte, n json.Number) ([]byte, error) { func AppendMarshalJSON(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}, escape bool) ([]byte, error) { rv := reflect.ValueOf(v) // convert by dynamic interface type - if code.AddrForMarshaler { + if (code.Flags & AddrForMarshalerFlags) != 0 { if rv.CanAddr() { rv = rv.Addr() } else { @@ -392,7 +393,7 @@ func AppendMarshalJSON(ctx *RuntimeContext, code *Opcode, b []byte, v interface{ func AppendMarshalJSONIndent(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}, escape bool) ([]byte, error) { rv := reflect.ValueOf(v) // convert by dynamic interface type - if code.AddrForMarshaler { + if (code.Flags & AddrForMarshalerFlags) != 0 { if rv.CanAddr() { rv = rv.Addr() } else { @@ -415,7 +416,7 @@ func AppendMarshalJSONIndent(ctx *RuntimeContext, code *Opcode, b []byte, v inte indentedBuf, err := doIndent( b, marshalBuf, - string(ctx.Prefix)+strings.Repeat(string(ctx.IndentStr), ctx.BaseIndent+code.Indent), + string(ctx.Prefix)+strings.Repeat(string(ctx.IndentStr), int(ctx.BaseIndent+code.Indent)), string(ctx.IndentStr), escape, ) @@ -428,7 +429,7 @@ func AppendMarshalJSONIndent(ctx *RuntimeContext, code *Opcode, b []byte, v inte func AppendMarshalText(code *Opcode, b []byte, v interface{}, escape bool) ([]byte, error) { rv := reflect.ValueOf(v) // convert by dynamic interface type - if code.AddrForMarshaler { + if (code.Flags & AddrForMarshalerFlags) != 0 { if rv.CanAddr() { rv = rv.Addr() } else { @@ -454,7 +455,7 @@ func AppendMarshalText(code *Opcode, b []byte, v interface{}, escape bool) ([]by func AppendMarshalTextIndent(code *Opcode, b []byte, v interface{}, escape bool) ([]byte, error) { rv := reflect.ValueOf(v) // convert by dynamic interface type - if code.AddrForMarshaler { + if (code.Flags & AddrForMarshalerFlags) != 0 { if rv.CanAddr() { rv = rv.Addr() } else { @@ -498,16 +499,16 @@ func AppendStructEndIndent(ctx *RuntimeContext, code *Opcode, b []byte) []byte { b = append(b, '\n') b = append(b, ctx.Prefix...) indentNum := ctx.BaseIndent + code.Indent - 1 - for i := 0; i < indentNum; i++ { + for i := uint32(0); i < indentNum; i++ { b = append(b, ctx.IndentStr...) } return append(b, '}', ',', '\n') } -func AppendIndent(ctx *RuntimeContext, b []byte, indent int) []byte { +func AppendIndent(ctx *RuntimeContext, b []byte, indent uint32) []byte { b = append(b, ctx.Prefix...) indentNum := ctx.BaseIndent + indent - for i := 0; i < indentNum; i++ { + for i := uint32(0); i < indentNum; i++ { b = append(b, ctx.IndentStr...) } return b diff --git a/internal/encoder/int.go b/internal/encoder/int.go index 70ea5f7..caec074 100644 --- a/internal/encoder/int.go +++ b/internal/encoder/int.go @@ -49,9 +49,14 @@ var intBELookup = [100]uint16{ var intLookup = [2]*[100]uint16{&intLELookup, &intBELookup} +func numMask(numBitSize uint8) uint64 { + return 1<>code.RshiftNum)&1 == 1 + mask := numMask(code.NumBitSize) + n := u64 & mask + negative := (u64>>(code.NumBitSize-1))&1 == 1 if !negative { if n < 10 { return append(out, byte(n+'0')) @@ -60,7 +65,7 @@ func AppendInt(out []byte, u64 uint64, code *Opcode) []byte { return append(out, byte(u), byte(u>>8)) } } else { - n = -n & code.Mask + n = -n & mask } lookup := intLookup[endianness] @@ -92,7 +97,8 @@ func AppendInt(out []byte, u64 uint64, code *Opcode) []byte { } func AppendUint(out []byte, u64 uint64, code *Opcode) []byte { - n := u64 & code.Mask + mask := numMask(code.NumBitSize) + n := u64 & mask if n < 10 { return append(out, byte(n+'0')) } else if n < 100 { diff --git a/internal/encoder/opcode.go b/internal/encoder/opcode.go index 0dfd6fb..220d5f3 100644 --- a/internal/encoder/opcode.go +++ b/internal/encoder/opcode.go @@ -2,7 +2,6 @@ package encoder import ( "fmt" - "math" "strings" "unsafe" @@ -11,61 +10,43 @@ import ( const uintptrSize = 4 << (^uintptr(0) >> 63) +type OpFlags uint8 + +const ( + AnonymousHeadFlags OpFlags = 1 << 0 + AnonymousKeyFlags OpFlags = 1 << 1 + IndirectFlags OpFlags = 1 << 2 + IsTaggedKeyFlags OpFlags = 1 << 3 + NilCheckFlags OpFlags = 1 << 4 + AddrForMarshalerFlags OpFlags = 1 << 5 + IsNextOpPtrTypeFlags OpFlags = 1 << 6 + IsNilableTypeFlags OpFlags = 1 << 7 +) + type Opcode struct { - Op OpType // operation type - Type *runtime.Type // go type - DisplayIdx int // opcode index - Key []byte // struct field key - EscapedKey []byte // struct field key ( HTML escaped ) - PtrNum int // pointer number: e.g. double pointer is 2. - DisplayKey string // key text to display - IsTaggedKey bool // whether tagged key - AnonymousKey bool // whether anonymous key - AnonymousHead bool // whether anonymous head or not - Indirect bool // whether indirect or not - Nilcheck bool // whether needs to nilcheck or not - AddrForMarshaler bool // whether needs to addr for marshaler or not - IsNextOpPtrType bool // whether next operation is ptr type or not - IsNilableType bool // whether type is nilable or not - RshiftNum uint8 // use to take bit for judging whether negative integer or not - Mask uint64 // mask for number - Indent int // indent number + Op OpType // operation type + Idx uint32 // offset to access ptr + Next *Opcode // next opcode + End *Opcode // array/slice/struct/map end + NextField *Opcode // next struct field + Key string // struct field key + Offset uint32 // offset size from struct header + PtrNum uint8 // pointer number: e.g. double pointer is 2. + Flags OpFlags + NumBitSize uint8 + _ [1]uint8 // 1 - Idx uintptr // offset to access ptr - HeadIdx uintptr // offset to access slice/struct head - ElemIdx uintptr // offset to access array/slice/map elem - Length uintptr // offset to access slice/map length or array length - MapIter uintptr // offset to access map iterator - MapPos uintptr // offset to access position list for sorted map - Offset uintptr // offset size from struct header - Size uintptr // array/slice elem size - - MapKey *Opcode // map key - MapValue *Opcode // map value - Elem *Opcode // array/slice elem - End *Opcode // array/slice/struct/map end - PrevField *Opcode // prev struct field - NextField *Opcode // next struct field - Next *Opcode // next opcode - Jmp *CompiledCode // for recursive call -} - -func rshitNum(bitSize uint8) uint8 { - return bitSize - 1 -} - -func (c *Opcode) setMaskAndRshiftNum(bitSize uint8) { - switch bitSize { - case 8: - c.Mask = math.MaxUint8 - case 16: - c.Mask = math.MaxUint16 - case 32: - c.Mask = math.MaxUint32 - case 64: - c.Mask = math.MaxUint64 - } - c.RshiftNum = rshitNum(bitSize) + Type *runtime.Type // go type + PrevField *Opcode // prev struct field + Jmp *CompiledCode // for recursive call + ElemIdx uint32 // offset to access array/slice/map elem + Length uint32 // offset to access slice/map length or array length + MapIter uint32 // offset to access map iterator + MapPos uint32 // offset to access position list for sorted map + Indent uint32 // indent number + Size uint32 // array/slice elem size + DisplayIdx uint32 // opcode index + DisplayKey string // key text to display } func (c *Opcode) ToHeaderType(isString bool) OpType { @@ -278,8 +259,8 @@ func newOpCode(ctx *compileContext, op OpType) *Opcode { return newOpCodeWithNext(ctx, op, newEndOp(ctx)) } -func opcodeOffset(idx int) uintptr { - return uintptr(idx) * uintptrSize +func opcodeOffset(idx int) uint32 { + return uint32(idx) * uintptrSize } func copyOpcode(code *Opcode) *Opcode { @@ -290,11 +271,11 @@ func copyOpcode(code *Opcode) *Opcode { func newOpCodeWithNext(ctx *compileContext, op OpType, next *Opcode) *Opcode { return &Opcode{ Op: op, + Idx: opcodeOffset(ctx.ptrIndex), + Next: next, Type: ctx.typ, DisplayIdx: ctx.opcodeIndex, Indent: ctx.indent, - Idx: opcodeOffset(ctx.ptrIndex), - Next: next, } } @@ -311,37 +292,24 @@ func (c *Opcode) copy(codeMap map[uintptr]*Opcode) *Opcode { return code } copied := &Opcode{ - Op: c.Op, - Type: c.Type, - DisplayIdx: c.DisplayIdx, - Key: c.Key, - EscapedKey: c.EscapedKey, - DisplayKey: c.DisplayKey, - PtrNum: c.PtrNum, - Mask: c.Mask, - RshiftNum: c.RshiftNum, - IsTaggedKey: c.IsTaggedKey, - AnonymousKey: c.AnonymousKey, - AnonymousHead: c.AnonymousHead, - Indirect: c.Indirect, - Nilcheck: c.Nilcheck, - AddrForMarshaler: c.AddrForMarshaler, - IsNextOpPtrType: c.IsNextOpPtrType, - IsNilableType: c.IsNilableType, - Indent: c.Indent, - Idx: c.Idx, - HeadIdx: c.HeadIdx, - ElemIdx: c.ElemIdx, - Length: c.Length, - MapIter: c.MapIter, - MapPos: c.MapPos, - Offset: c.Offset, - Size: c.Size, + Op: c.Op, + Key: c.Key, + PtrNum: c.PtrNum, + NumBitSize: c.NumBitSize, + Flags: c.Flags, + Idx: c.Idx, + Offset: c.Offset, + Type: c.Type, + DisplayIdx: c.DisplayIdx, + DisplayKey: c.DisplayKey, + ElemIdx: c.ElemIdx, + Length: c.Length, + MapIter: c.MapIter, + MapPos: c.MapPos, + Size: c.Size, + Indent: c.Indent, } codeMap[addr] = copied - copied.MapKey = c.MapKey.copy(codeMap) - copied.MapValue = c.MapValue.copy(codeMap) - copied.Elem = c.Elem.copy(codeMap) copied.End = c.End.copy(codeMap) copied.PrevField = c.PrevField.copy(codeMap) copied.NextField = c.NextField.copy(codeMap) @@ -387,9 +355,8 @@ func (c *Opcode) TotalLength() int { func (c *Opcode) decOpcodeIndex() { for code := c; code.Op != OpEnd; { code.DisplayIdx-- - code.Idx -= uintptrSize - if code.HeadIdx > 0 { - code.HeadIdx -= uintptrSize + if code.Idx > 0 { + code.Idx -= uintptrSize } if code.ElemIdx > 0 { code.ElemIdx -= uintptrSize @@ -422,19 +389,18 @@ func (c *Opcode) decIndent() { } func (c *Opcode) dumpHead(code *Opcode) string { - var length uintptr + var length uint32 if code.Op.CodeType() == CodeArrayHead { length = code.Length } else { length = code.Length / uintptrSize } return fmt.Sprintf( - `[%d]%s%s ([idx:%d][headIdx:%d][elemIdx:%d][length:%d])`, + `[%d]%s%s ([idx:%d][elemIdx:%d][length:%d])`, code.DisplayIdx, - strings.Repeat("-", code.Indent), + strings.Repeat("-", int(code.Indent)), code.Op, code.Idx/uintptrSize, - code.HeadIdx/uintptrSize, code.ElemIdx/uintptrSize, length, ) @@ -442,12 +408,11 @@ func (c *Opcode) dumpHead(code *Opcode) string { func (c *Opcode) dumpMapHead(code *Opcode) string { return fmt.Sprintf( - `[%d]%s%s ([idx:%d][headIdx:%d][elemIdx:%d][length:%d][mapIter:%d])`, + `[%d]%s%s ([idx:%d][elemIdx:%d][length:%d][mapIter:%d])`, code.DisplayIdx, - strings.Repeat("-", code.Indent), + strings.Repeat("-", int(code.Indent)), code.Op, code.Idx/uintptrSize, - code.HeadIdx/uintptrSize, code.ElemIdx/uintptrSize, code.Length/uintptrSize, code.MapIter/uintptrSize, @@ -458,7 +423,7 @@ func (c *Opcode) dumpMapEnd(code *Opcode) string { return fmt.Sprintf( `[%d]%s%s ([idx:%d][mapPos:%d][length:%d])`, code.DisplayIdx, - strings.Repeat("-", code.Indent), + strings.Repeat("-", int(code.Indent)), code.Op, code.Idx/uintptrSize, code.MapPos/uintptrSize, @@ -467,19 +432,18 @@ func (c *Opcode) dumpMapEnd(code *Opcode) string { } func (c *Opcode) dumpElem(code *Opcode) string { - var length uintptr + var length uint32 if code.Op.CodeType() == CodeArrayElem { length = code.Length } else { length = code.Length / uintptrSize } return fmt.Sprintf( - `[%d]%s%s ([idx:%d][headIdx:%d][elemIdx:%d][length:%d][size:%d])`, + `[%d]%s%s ([idx:%d][elemIdx:%d][length:%d][size:%d])`, code.DisplayIdx, - strings.Repeat("-", code.Indent), + strings.Repeat("-", int(code.Indent)), code.Op, code.Idx/uintptrSize, - code.HeadIdx/uintptrSize, code.ElemIdx/uintptrSize, length, code.Size, @@ -488,14 +452,13 @@ func (c *Opcode) dumpElem(code *Opcode) string { func (c *Opcode) dumpField(code *Opcode) string { return fmt.Sprintf( - `[%d]%s%s ([idx:%d][key:%s][offset:%d][headIdx:%d])`, + `[%d]%s%s ([idx:%d][key:%s][offset:%d])`, code.DisplayIdx, - strings.Repeat("-", code.Indent), + strings.Repeat("-", int(code.Indent)), code.Op, code.Idx/uintptrSize, code.DisplayKey, code.Offset, - code.HeadIdx/uintptrSize, ) } @@ -503,7 +466,7 @@ func (c *Opcode) dumpKey(code *Opcode) string { return fmt.Sprintf( `[%d]%s%s ([idx:%d][elemIdx:%d][length:%d][mapIter:%d])`, code.DisplayIdx, - strings.Repeat("-", code.Indent), + strings.Repeat("-", int(code.Indent)), code.Op, code.Idx/uintptrSize, code.ElemIdx/uintptrSize, @@ -516,7 +479,7 @@ func (c *Opcode) dumpValue(code *Opcode) string { return fmt.Sprintf( `[%d]%s%s ([idx:%d][mapIter:%d])`, code.DisplayIdx, - strings.Repeat("-", code.Indent), + strings.Repeat("-", int(code.Indent)), code.Op, code.Idx/uintptrSize, code.MapIter/uintptrSize, @@ -555,7 +518,7 @@ func (c *Opcode) Dump() string { codes = append(codes, fmt.Sprintf( "[%d]%s%s ([idx:%d])", code.DisplayIdx, - strings.Repeat("-", code.Indent), + strings.Repeat("-", int(code.Indent)), code.Op, code.Idx/uintptrSize, )) @@ -610,9 +573,8 @@ func newSliceHeaderCode(ctx *compileContext) *Opcode { length := opcodeOffset(ctx.ptrIndex) return &Opcode{ Op: OpSlice, - DisplayIdx: ctx.opcodeIndex, Idx: idx, - HeadIdx: idx, + DisplayIdx: ctx.opcodeIndex, ElemIdx: elemIdx, Length: length, Indent: ctx.indent, @@ -622,13 +584,12 @@ func newSliceHeaderCode(ctx *compileContext) *Opcode { func newSliceElemCode(ctx *compileContext, head *Opcode, size uintptr) *Opcode { return &Opcode{ Op: OpSliceElem, + Idx: head.Idx, DisplayIdx: ctx.opcodeIndex, - Idx: opcodeOffset(ctx.ptrIndex), - HeadIdx: head.Idx, ElemIdx: head.ElemIdx, Length: head.Length, Indent: ctx.indent, - Size: size, + Size: uint32(size), } } @@ -638,25 +599,23 @@ func newArrayHeaderCode(ctx *compileContext, alen int) *Opcode { elemIdx := opcodeOffset(ctx.ptrIndex) return &Opcode{ Op: OpArray, - DisplayIdx: ctx.opcodeIndex, Idx: idx, - HeadIdx: idx, + DisplayIdx: ctx.opcodeIndex, ElemIdx: elemIdx, Indent: ctx.indent, - Length: uintptr(alen), + Length: uint32(alen), } } func newArrayElemCode(ctx *compileContext, head *Opcode, length int, size uintptr) *Opcode { return &Opcode{ Op: OpArrayElem, + Idx: head.Idx, DisplayIdx: ctx.opcodeIndex, - Idx: opcodeOffset(ctx.ptrIndex), ElemIdx: head.ElemIdx, - HeadIdx: head.HeadIdx, - Length: uintptr(length), + Length: uint32(length), Indent: ctx.indent, - Size: size, + Size: uint32(size), } } @@ -670,9 +629,9 @@ func newMapHeaderCode(ctx *compileContext) *Opcode { mapIter := opcodeOffset(ctx.ptrIndex) return &Opcode{ Op: OpMap, + Idx: idx, Type: ctx.typ, DisplayIdx: ctx.opcodeIndex, - Idx: idx, ElemIdx: elemIdx, Length: length, MapIter: mapIter, @@ -683,8 +642,8 @@ func newMapHeaderCode(ctx *compileContext) *Opcode { func newMapKeyCode(ctx *compileContext, head *Opcode) *Opcode { return &Opcode{ Op: OpMapKey, - DisplayIdx: ctx.opcodeIndex, Idx: opcodeOffset(ctx.ptrIndex), + DisplayIdx: ctx.opcodeIndex, ElemIdx: head.ElemIdx, Length: head.Length, MapIter: head.MapIter, @@ -695,8 +654,8 @@ func newMapKeyCode(ctx *compileContext, head *Opcode) *Opcode { func newMapValueCode(ctx *compileContext, head *Opcode) *Opcode { return &Opcode{ Op: OpMapValue, - DisplayIdx: ctx.opcodeIndex, Idx: opcodeOffset(ctx.ptrIndex), + DisplayIdx: ctx.opcodeIndex, ElemIdx: head.ElemIdx, Length: head.Length, MapIter: head.MapIter, @@ -710,34 +669,34 @@ func newMapEndCode(ctx *compileContext, head *Opcode) *Opcode { idx := opcodeOffset(ctx.ptrIndex) return &Opcode{ Op: OpMapEnd, - DisplayIdx: ctx.opcodeIndex, Idx: idx, + Next: newEndOp(ctx), + DisplayIdx: ctx.opcodeIndex, Length: head.Length, MapPos: mapPos, Indent: ctx.indent, - Next: newEndOp(ctx), } } func newInterfaceCode(ctx *compileContext) *Opcode { return &Opcode{ Op: OpInterface, + Idx: opcodeOffset(ctx.ptrIndex), + Next: newEndOp(ctx), Type: ctx.typ, DisplayIdx: ctx.opcodeIndex, - Idx: opcodeOffset(ctx.ptrIndex), Indent: ctx.indent, - Next: newEndOp(ctx), } } func newRecursiveCode(ctx *compileContext, jmp *CompiledCode) *Opcode { return &Opcode{ Op: OpRecursive, + Idx: opcodeOffset(ctx.ptrIndex), + Next: newEndOp(ctx), Type: ctx.typ, DisplayIdx: ctx.opcodeIndex, - Idx: opcodeOffset(ctx.ptrIndex), Indent: ctx.indent, - Next: newEndOp(ctx), Jmp: jmp, } } diff --git a/internal/encoder/optype.go b/internal/encoder/optype.go index 21ac345..50dd8b2 100644 --- a/internal/encoder/optype.go +++ b/internal/encoder/optype.go @@ -425,7 +425,7 @@ var opTypeStrings = [400]string{ "StructEndOmitEmpty", } -type OpType int +type OpType uint16 const ( OpEnd OpType = 0 diff --git a/internal/encoder/vm/debug_vm.go b/internal/encoder/vm/debug_vm.go index 43525e1..1a49c0d 100644 --- a/internal/encoder/vm/debug_vm.go +++ b/internal/encoder/vm/debug_vm.go @@ -14,7 +14,7 @@ func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, fmt.Println(codeSet.Type) fmt.Printf("\n") fmt.Println("* [ALL OPCODE]") - fmt.Println(codeSet.Code.Dump()) + fmt.Println(ctx.Code.Dump()) fmt.Printf("\n") fmt.Println("* [CONTEXT]") fmt.Printf("%+v\n", ctx) diff --git a/internal/encoder/vm/util.go b/internal/encoder/vm/util.go index 01e608f..2887827 100644 --- a/internal/encoder/vm/util.go +++ b/internal/encoder/vm/util.go @@ -37,20 +37,20 @@ func errUnimplementedOp(op encoder.OpType) error { return fmt.Errorf("encoder: opcode %s has not been implemented", op) } -func load(base uintptr, idx uintptr) uintptr { - addr := base + idx +func load(base uintptr, idx uint32) uintptr { + addr := base + uintptr(idx) return **(**uintptr)(unsafe.Pointer(&addr)) } -func store(base uintptr, idx uintptr, p uintptr) { - addr := base + idx +func store(base uintptr, idx uint32, p uintptr) { + addr := base + uintptr(idx) **(**uintptr)(unsafe.Pointer(&addr)) = p } -func loadNPtr(base uintptr, idx uintptr, ptrNum int) uintptr { - addr := base + idx +func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr { + addr := base + uintptr(idx) p := **(**uintptr)(unsafe.Pointer(&addr)) - for i := 0; i < ptrNum; i++ { + for i := uint8(0); i < ptrNum; i++ { if p == 0 { return 0 } @@ -70,8 +70,8 @@ func ptrToSlice(p uintptr) *runtime.SliceHeader { return *(**runtime.SliceHeader func ptrToPtr(p uintptr) uintptr { return uintptr(**(**unsafe.Pointer)(unsafe.Pointer(&p))) } -func ptrToNPtr(p uintptr, ptrNum int) uintptr { - for i := 0; i < ptrNum; i++ { +func ptrToNPtr(p uintptr, ptrNum uint8) uintptr { + for i := uint8(0); i < ptrNum; i++ { if p == 0 { return 0 } @@ -146,6 +146,7 @@ func appendInterface(ctx *encoder.RuntimeContext, codeSet *encoder.OpcodeSet, op newPtrs[0] = uintptr(iface.ptr) ctx.Ptrs = newPtrs + ctx.Code = ifaceCodeSet.NoescapeKeyCode bb, err := Run(ctx, b, ifaceCodeSet, opt) if err != nil { diff --git a/internal/encoder/vm/vm.go b/internal/encoder/vm/vm.go index 9522364..7af9d3a 100644 --- a/internal/encoder/vm/vm.go +++ b/internal/encoder/vm/vm.go @@ -13,7 +13,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt recursiveLevel := 0 ptrOffset := uintptr(0) ctxptr := ctx.Ptr() - code := codeSet.Code + code := ctx.Code for { switch code.Op { @@ -212,7 +212,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next break } - if code.IsNilableType && code.Indirect { + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { p = ptrToPtr(p) } bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -239,7 +239,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next break } - if code.IsNilableType && code.Indirect { + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { p = ptrToPtr(p) } bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -285,8 +285,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if idx < length { b = appendArrayElemIndent(ctx, code, b) store(ctxptr, code.ElemIdx, idx) - data := load(ctxptr, code.HeadIdx) - size := code.Size + data := load(ctxptr, code.Idx) + size := uintptr(code.Size) code = code.Next store(ctxptr, code.Idx, data+idx*size) } else { @@ -323,11 +323,11 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpArrayElem: idx := load(ctxptr, code.ElemIdx) idx++ - if idx < code.Length { + if idx < uintptr(code.Length) { b = appendArrayElemIndent(ctx, code, b) store(ctxptr, code.ElemIdx, idx) - p := load(ctxptr, code.HeadIdx) - size := code.Size + p := load(ctxptr, code.Idx) + size := uintptr(code.Size) code = code.Next store(ctxptr, code.Idx, p+idx*size) } else { @@ -508,7 +508,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHead: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -519,27 +519,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHead: p := load(ctxptr, code.Idx) - if p == 0 && (code.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if !code.AnonymousKey && len(code.Key) > 0 { + if (code.Flags&encoder.AnonymousKeyFlags) == 0 && len(code.Key) > 0 { b = appendStructKey(ctx, code, b) } - p += code.Offset + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmpty: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -550,19 +550,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmpty: p := load(ctxptr, code.Idx) - if p == 0 && (code.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - p += code.Offset - if p == 0 || (ptrToPtr(p) == 0 && code.IsNextOpPtrType) { + p += uintptr(code.Offset) + if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -570,10 +570,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, p) } case encoder.OpStructPtrHeadInt: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -586,25 +586,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadInt: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyInt: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -617,18 +617,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyInt: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -638,10 +638,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadIntString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -654,27 +654,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadIntString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -687,18 +687,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyIntString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -712,7 +712,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadIntPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -723,20 +723,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadIntPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -748,7 +748,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyIntPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -759,19 +759,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyIntPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -782,7 +782,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -793,20 +793,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadIntPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -820,7 +820,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -831,19 +831,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -854,10 +854,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadUint: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -870,25 +870,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadUint: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUint: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -901,18 +901,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyUint: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -922,10 +922,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadUintString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -938,27 +938,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadUintString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -971,18 +971,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyUintString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -996,7 +996,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadUintPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1007,20 +1007,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadUintPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1032,7 +1032,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyUintPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1043,19 +1043,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyUintPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1066,7 +1066,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1077,20 +1077,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadUintPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1104,7 +1104,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1115,19 +1115,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1138,10 +1138,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadFloat32: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1154,25 +1154,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat32: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1185,17 +1185,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat32: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat32(p + code.Offset) + v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1205,10 +1205,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadFloat32String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1221,27 +1221,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat32String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1254,17 +1254,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat32String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat32(p + code.Offset) + v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1278,7 +1278,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1289,20 +1289,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat32Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1314,7 +1314,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1325,19 +1325,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1348,7 +1348,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1359,20 +1359,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat32PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1386,7 +1386,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1397,19 +1397,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1420,10 +1420,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadFloat64: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1436,18 +1436,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat64: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) @@ -1455,10 +1455,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1471,17 +1471,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat64: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1494,10 +1494,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadFloat64String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1510,17 +1510,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat64String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -1531,10 +1531,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1547,17 +1547,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat64String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1574,7 +1574,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1585,20 +1585,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat64Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1614,7 +1614,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1625,19 +1625,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1652,7 +1652,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1663,20 +1663,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat64PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1694,7 +1694,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1705,19 +1705,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1732,10 +1732,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1748,25 +1748,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) + b = appendString(b, ptrToString(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1779,17 +1779,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToString(p + code.Offset) + v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -1799,10 +1799,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadStringString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1815,25 +1815,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadStringString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p+code.Offset)))) + b = appendString(b, string(appendString([]byte{}, ptrToString(p+uintptr(code.Offset))))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyStringString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1846,17 +1846,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyStringString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToString(p + code.Offset) + v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -1868,7 +1868,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadStringPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1879,20 +1879,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadStringPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1904,7 +1904,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyStringPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1915,19 +1915,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyStringPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1938,7 +1938,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1949,20 +1949,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadStringPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1974,7 +1974,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1985,19 +1985,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2006,10 +2006,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadBool: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2022,25 +2022,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBool: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBool: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2053,17 +2053,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBool: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToBool(p + code.Offset) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = appendBool(b, v) @@ -2073,10 +2073,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.NextField } case encoder.OpStructPtrHeadBoolString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2089,27 +2089,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBoolString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2122,17 +2122,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBoolString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToBool(p + code.Offset) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -2146,7 +2146,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadBoolPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2157,20 +2157,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBoolPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2182,7 +2182,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2193,19 +2193,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2216,7 +2216,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2227,20 +2227,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBoolPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2254,7 +2254,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2265,19 +2265,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2288,10 +2288,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadBytes: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2304,25 +2304,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBytes: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) + b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBytes: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2335,17 +2335,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBytes: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToBytes(p + code.Offset) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) == 0 { code = code.NextField } else { @@ -2357,7 +2357,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2368,20 +2368,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBytesPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2393,7 +2393,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2404,19 +2404,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2425,10 +2425,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadNumber: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2441,28 +2441,28 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadNumber: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = appendComma(bb) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumber: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2475,17 +2475,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyNumber: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToNumber(p + code.Offset) + v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -2498,10 +2498,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadNumberString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2514,19 +2514,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadNumberString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -2534,10 +2534,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2550,17 +2550,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyNumberString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToNumber(p + code.Offset) + v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -2577,7 +2577,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2588,20 +2588,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadNumberPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2617,7 +2617,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2628,19 +2628,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2654,7 +2654,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2665,20 +2665,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadNumberPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2695,7 +2695,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2706,19 +2706,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2732,10 +2732,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2748,25 +2748,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadArray, encoder.OpStructHeadSlice: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - p += code.Offset + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmptyArray: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2779,25 +2779,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyArray: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - p += code.Offset + p += uintptr(code.Offset) b = appendStructKey(ctx, code, b) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmptySlice: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2810,17 +2810,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptySlice: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - p += code.Offset + p += uintptr(code.Offset) slice := ptrToSlice(p) if slice.Len == 0 { code = code.NextField @@ -2832,7 +2832,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2843,20 +2843,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2869,7 +2869,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyArrayPtr, encoder.OpStructPtrHeadOmitEmptySlicePtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2880,19 +2880,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyArrayPtr, encoder.OpStructHeadOmitEmptySlicePtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { code = code.NextField @@ -2904,7 +2904,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMap: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2915,27 +2915,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMap: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if p != 0 && code.Indirect { - p = ptrToPtr(p + code.Offset) + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) } code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmptyMap: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2946,19 +2946,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMap: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if p != 0 && code.Indirect { - p = ptrToPtr(p + code.Offset) + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) } if maplen(ptrToUnsafePtr(p)) == 0 { code = code.NextField @@ -2970,7 +2970,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMapPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2981,15 +2981,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMapPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) @@ -2999,13 +2999,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.NextField break } - p = ptrToPtr(p + code.Offset) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 { b = appendNull(b) b = appendComma(b) code = code.NextField } else { - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p, code.PtrNum) } code = code.Next @@ -3014,7 +3014,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMapPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3025,26 +3025,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMapPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } if p == 0 { code = code.NextField break } - p = ptrToPtr(p + code.Offset) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 { code = code.NextField } else { - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p, code.PtrNum) } b = appendStructKey(ctx, code, b) @@ -3054,37 +3054,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadMarshalJSON: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadMarshalJSON { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -3098,37 +3098,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { + p = ptrToPtr(p + uintptr(code.Offset)) } } iface := ptrToInterface(code, p) - if code.Nilcheck && encoder.IsNilForMarshaler(iface) { + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -3143,7 +3143,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3154,20 +3154,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -3183,7 +3183,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3194,18 +3194,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } if p == 0 { @@ -3223,37 +3223,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalText: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadMarshalText: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadMarshalText { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -3267,36 +3267,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -3311,7 +3311,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3322,20 +3322,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMarshalTextPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -3351,7 +3351,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3362,18 +3362,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } if p == 0 { @@ -3389,16 +3389,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructField: - if !code.AnonymousKey { + if code.Flags&encoder.AnonymousKeyFlags == 0 { b = appendStructKey(ctx, code, b) } - p := load(ctxptr, code.HeadIdx) + code.Offset + p := load(ctxptr, code.Idx) + uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmpty: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if ptrToPtr(p) == 0 && code.IsNextOpPtrType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -3406,15 +3406,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, p) } case encoder.OpStructFieldInt: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyInt: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, u64, code) @@ -3422,17 +3422,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldIntString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyIntString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3442,8 +3442,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3453,8 +3453,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p), code) @@ -3462,8 +3462,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3475,8 +3475,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3486,15 +3486,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUint: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUint: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, u64, code) @@ -3502,17 +3502,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUintString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUintString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3522,8 +3522,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3533,8 +3533,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p), code) @@ -3542,8 +3542,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3555,8 +3555,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3566,14 +3566,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, v) @@ -3581,16 +3581,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32String: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3600,8 +3600,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3611,8 +3611,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, ptrToFloat32(p)) @@ -3620,8 +3620,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3633,8 +3633,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3644,9 +3644,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -3654,8 +3654,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -3666,8 +3666,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -3678,8 +3678,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -3692,8 +3692,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3709,8 +3709,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) v := ptrToFloat64(p) @@ -3722,8 +3722,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3739,8 +3739,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3754,14 +3754,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) + b = appendString(b, ptrToString(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, v) @@ -3769,15 +3769,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldStringString: - p := load(ctxptr, code.HeadIdx) - s := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + s := ptrToString(p + uintptr(code.Offset)) b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, s))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyStringString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, v))) @@ -3785,8 +3785,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3796,8 +3796,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, ptrToString(p)) @@ -3805,8 +3805,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3816,8 +3816,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) @@ -3825,14 +3825,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBool: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBool: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = appendBool(b, v) @@ -3840,16 +3840,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBoolString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolString: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3859,8 +3859,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3870,8 +3870,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendBool(b, ptrToBool(p)) @@ -3879,8 +3879,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3892,8 +3892,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3903,14 +3903,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBytes: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) + b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, v) @@ -3918,8 +3918,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3929,8 +3929,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, ptrToBytes(p)) @@ -3938,17 +3938,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumber: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = appendComma(bb) code = code.Next case encoder.OpStructFieldOmitEmptyNumber: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, v) @@ -3959,10 +3959,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumberString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -3970,8 +3970,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberString: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3984,8 +3984,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3999,8 +3999,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, ptrToNumber(p)) @@ -4011,8 +4011,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -4027,8 +4027,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4041,13 +4041,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldMarshalJSON: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p += code.Offset - if code.IsNilableType { + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -4059,17 +4059,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSON: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if code.IsNilableType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField break } iface := ptrToInterface(code, p) - if code.Nilcheck && encoder.IsNilForMarshaler(iface) { + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { code = code.NextField break } @@ -4081,9 +4081,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) code = code.Next case encoder.OpStructFieldMarshalJSONPtr: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4096,8 +4096,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSONPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -4108,13 +4108,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldMarshalText: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p += code.Offset - if code.IsNilableType { + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -4126,12 +4126,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalText: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if code.IsNilableType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField break } @@ -4143,9 +4143,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) code = code.Next case encoder.OpStructFieldMarshalTextPtr: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4158,8 +4158,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalTextPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -4171,25 +4171,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructFieldArray: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyArray: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldArrayPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyArrayPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) code = code.Next @@ -4199,13 +4199,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldSlice: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptySlice: - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) slice := ptrToSlice(p) if slice.Len == 0 { code = code.NextField @@ -4216,13 +4216,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldSlicePtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptySlicePtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) code = code.Next @@ -4232,13 +4232,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldMap: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyMap: - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 { code = code.NextField } else { @@ -4248,16 +4248,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldMapPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) if p != 0 { p = ptrToNPtr(p, code.PtrNum) } code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyMapPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) if p != 0 { p = ptrToNPtr(p, code.PtrNum) } @@ -4270,14 +4270,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldStruct: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyStruct: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if ptrToPtr(p) == 0 && code.IsNextOpPtrType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -4290,15 +4290,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEndSkipLast(ctx, code, b) code = code.Next case encoder.OpStructEndInt: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyInt: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, u64, code) @@ -4308,17 +4308,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndIntString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4331,8 +4331,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndIntPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4341,8 +4341,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p), code) @@ -4353,8 +4353,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndIntPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4365,8 +4365,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4378,15 +4378,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndUint: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUint: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, u64, code) @@ -4396,17 +4396,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndUintString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4419,8 +4419,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndUintPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4429,8 +4429,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p), code) @@ -4441,8 +4441,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndUintPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4453,8 +4453,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4466,14 +4466,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat32: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, v) @@ -4483,16 +4483,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat32String: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4505,8 +4505,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat32Ptr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4515,8 +4515,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, ptrToFloat32(p)) @@ -4527,8 +4527,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat32PtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4539,8 +4539,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4552,8 +4552,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -4562,8 +4562,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -4576,8 +4576,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -4588,8 +4588,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -4605,8 +4605,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat64Ptr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) b = appendStructEnd(ctx, code, b) @@ -4621,8 +4621,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) v := ptrToFloat64(p) @@ -4637,8 +4637,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat64PtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4653,8 +4653,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) v := ptrToFloat64(p) @@ -4670,14 +4670,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) + b = appendString(b, ptrToString(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, v) @@ -4687,15 +4687,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndStringString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - s := ptrToString(p + code.Offset) + s := ptrToString(p + uintptr(code.Offset)) b = appendString(b, string(appendString([]byte{}, s))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, v))) @@ -4706,8 +4706,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndStringPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4716,8 +4716,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, ptrToString(p)) @@ -4728,8 +4728,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndStringPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4738,8 +4738,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) @@ -4749,14 +4749,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndBool: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBool: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = appendBool(b, v) @@ -4766,16 +4766,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndBoolString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBoolString: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4788,8 +4788,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBoolPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4798,8 +4798,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendBool(b, ptrToBool(p)) @@ -4810,8 +4810,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBoolPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4822,8 +4822,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4835,14 +4835,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndBytes: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) + b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, v) @@ -4853,8 +4853,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBytesPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4863,8 +4863,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, ptrToBytes(p)) @@ -4874,17 +4874,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndNumber: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = appendStructEnd(ctx, code, bb) code = code.Next case encoder.OpStructEndOmitEmptyNumber: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, v) @@ -4897,10 +4897,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndNumberString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -4908,8 +4908,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberString: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4925,8 +4925,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndNumberPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4939,8 +4939,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, ptrToNumber(p)) @@ -4954,8 +4954,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndNumberPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4969,8 +4969,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') diff --git a/internal/encoder/vm_escaped/debug_vm.go b/internal/encoder/vm_escaped/debug_vm.go index 0139f57..a4e773c 100644 --- a/internal/encoder/vm_escaped/debug_vm.go +++ b/internal/encoder/vm_escaped/debug_vm.go @@ -14,7 +14,7 @@ func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, fmt.Println(codeSet.Type) fmt.Printf("\n") fmt.Println("* [ALL OPCODE]") - fmt.Println(codeSet.Code.Dump()) + fmt.Println(ctx.Code.Dump()) fmt.Printf("\n") fmt.Println("* [CONTEXT]") fmt.Printf("%+v\n", ctx) diff --git a/internal/encoder/vm_escaped/util.go b/internal/encoder/vm_escaped/util.go index 129eb2c..13fd3e3 100644 --- a/internal/encoder/vm_escaped/util.go +++ b/internal/encoder/vm_escaped/util.go @@ -37,20 +37,20 @@ func errUnimplementedOp(op encoder.OpType) error { return fmt.Errorf("encoder (escaped): opcode %s has not been implemented", op) } -func load(base uintptr, idx uintptr) uintptr { - addr := base + idx +func load(base uintptr, idx uint32) uintptr { + addr := base + uintptr(idx) return **(**uintptr)(unsafe.Pointer(&addr)) } -func store(base uintptr, idx uintptr, p uintptr) { - addr := base + idx +func store(base uintptr, idx uint32, p uintptr) { + addr := base + uintptr(idx) **(**uintptr)(unsafe.Pointer(&addr)) = p } -func loadNPtr(base uintptr, idx uintptr, ptrNum int) uintptr { - addr := base + idx +func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr { + addr := base + uintptr(idx) p := **(**uintptr)(unsafe.Pointer(&addr)) - for i := 0; i < ptrNum; i++ { + for i := uint8(0); i < ptrNum; i++ { if p == 0 { return 0 } @@ -70,8 +70,8 @@ func ptrToSlice(p uintptr) *runtime.SliceHeader { return *(**runtime.SliceHeader func ptrToPtr(p uintptr) uintptr { return uintptr(**(**unsafe.Pointer)(unsafe.Pointer(&p))) } -func ptrToNPtr(p uintptr, ptrNum int) uintptr { - for i := 0; i < ptrNum; i++ { +func ptrToNPtr(p uintptr, ptrNum uint8) uintptr { + for i := uint8(0); i < ptrNum; i++ { if p == 0 { return 0 } @@ -146,6 +146,7 @@ func appendInterface(ctx *encoder.RuntimeContext, codeSet *encoder.OpcodeSet, op newPtrs[0] = uintptr(iface.ptr) ctx.Ptrs = newPtrs + ctx.Code = ifaceCodeSet.EscapeKeyCode bb, err := Run(ctx, b, ifaceCodeSet, opt) if err != nil { @@ -193,7 +194,7 @@ func appendStructHead(b []byte) []byte { } func appendStructKey(_ *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { - return append(b, code.EscapedKey...) + return append(b, code.Key...) } func appendStructEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { diff --git a/internal/encoder/vm_escaped/vm.go b/internal/encoder/vm_escaped/vm.go index 03d5b4e..eb6a923 100644 --- a/internal/encoder/vm_escaped/vm.go +++ b/internal/encoder/vm_escaped/vm.go @@ -13,7 +13,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt recursiveLevel := 0 ptrOffset := uintptr(0) ctxptr := ctx.Ptr() - code := codeSet.Code + code := ctx.Code for { switch code.Op { @@ -212,7 +212,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next break } - if code.IsNilableType && code.Indirect { + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { p = ptrToPtr(p) } bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -239,7 +239,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next break } - if code.IsNilableType && code.Indirect { + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { p = ptrToPtr(p) } bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -285,8 +285,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if idx < length { b = appendArrayElemIndent(ctx, code, b) store(ctxptr, code.ElemIdx, idx) - data := load(ctxptr, code.HeadIdx) - size := code.Size + data := load(ctxptr, code.Idx) + size := uintptr(code.Size) code = code.Next store(ctxptr, code.Idx, data+idx*size) } else { @@ -323,11 +323,11 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpArrayElem: idx := load(ctxptr, code.ElemIdx) idx++ - if idx < code.Length { + if idx < uintptr(code.Length) { b = appendArrayElemIndent(ctx, code, b) store(ctxptr, code.ElemIdx, idx) - p := load(ctxptr, code.HeadIdx) - size := code.Size + p := load(ctxptr, code.Idx) + size := uintptr(code.Size) code = code.Next store(ctxptr, code.Idx, p+idx*size) } else { @@ -508,7 +508,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHead: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -519,27 +519,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHead: p := load(ctxptr, code.Idx) - if p == 0 && (code.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if !code.AnonymousKey && len(code.Key) > 0 { + if (code.Flags&encoder.AnonymousKeyFlags) == 0 && len(code.Key) > 0 { b = appendStructKey(ctx, code, b) } - p += code.Offset + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmpty: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -550,19 +550,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmpty: p := load(ctxptr, code.Idx) - if p == 0 && (code.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - p += code.Offset - if p == 0 || (ptrToPtr(p) == 0 && code.IsNextOpPtrType) { + p += uintptr(code.Offset) + if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -570,10 +570,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, p) } case encoder.OpStructPtrHeadInt: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -586,25 +586,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadInt: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyInt: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -617,18 +617,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyInt: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -638,10 +638,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadIntString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -654,27 +654,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadIntString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -687,18 +687,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyIntString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -712,7 +712,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadIntPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -723,20 +723,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadIntPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -748,7 +748,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyIntPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -759,19 +759,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyIntPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -782,7 +782,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -793,20 +793,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadIntPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -820,7 +820,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -831,19 +831,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -854,10 +854,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadUint: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -870,25 +870,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadUint: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUint: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -901,18 +901,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyUint: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -922,10 +922,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadUintString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -938,27 +938,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadUintString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -971,18 +971,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyUintString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -996,7 +996,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadUintPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1007,20 +1007,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadUintPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1032,7 +1032,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyUintPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1043,19 +1043,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyUintPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1066,7 +1066,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1077,20 +1077,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadUintPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1104,7 +1104,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1115,19 +1115,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1138,10 +1138,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadFloat32: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1154,25 +1154,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat32: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1185,17 +1185,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat32: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat32(p + code.Offset) + v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1205,10 +1205,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadFloat32String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1221,27 +1221,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat32String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1254,17 +1254,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat32String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat32(p + code.Offset) + v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1278,7 +1278,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1289,20 +1289,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat32Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1314,7 +1314,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1325,19 +1325,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1348,7 +1348,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1359,20 +1359,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat32PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1386,7 +1386,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1397,19 +1397,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1420,10 +1420,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadFloat64: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1436,18 +1436,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat64: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) @@ -1455,10 +1455,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1471,17 +1471,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat64: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1494,10 +1494,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadFloat64String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1510,17 +1510,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat64String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -1531,10 +1531,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1547,17 +1547,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat64String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1574,7 +1574,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1585,20 +1585,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat64Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1614,7 +1614,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1625,19 +1625,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1652,7 +1652,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1663,20 +1663,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat64PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1694,7 +1694,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1705,19 +1705,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1732,10 +1732,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1748,25 +1748,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) + b = appendString(b, ptrToString(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1779,17 +1779,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToString(p + code.Offset) + v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -1799,10 +1799,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadStringString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1815,25 +1815,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadStringString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p+code.Offset)))) + b = appendString(b, string(appendString([]byte{}, ptrToString(p+uintptr(code.Offset))))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyStringString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1846,17 +1846,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyStringString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToString(p + code.Offset) + v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -1868,7 +1868,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadStringPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1879,20 +1879,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadStringPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1904,7 +1904,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyStringPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1915,19 +1915,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyStringPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1938,7 +1938,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1949,20 +1949,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadStringPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1974,7 +1974,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1985,19 +1985,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2006,10 +2006,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadBool: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2022,25 +2022,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBool: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBool: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2053,17 +2053,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBool: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToBool(p + code.Offset) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = appendBool(b, v) @@ -2073,10 +2073,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.NextField } case encoder.OpStructPtrHeadBoolString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2089,27 +2089,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBoolString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2122,17 +2122,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBoolString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToBool(p + code.Offset) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -2146,7 +2146,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadBoolPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2157,20 +2157,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBoolPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2182,7 +2182,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2193,19 +2193,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2216,7 +2216,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2227,20 +2227,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBoolPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2254,7 +2254,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2265,19 +2265,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2288,10 +2288,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadBytes: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2304,25 +2304,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBytes: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) + b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBytes: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2335,17 +2335,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBytes: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToBytes(p + code.Offset) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) == 0 { code = code.NextField } else { @@ -2357,7 +2357,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2368,20 +2368,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBytesPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2393,7 +2393,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2404,19 +2404,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2425,10 +2425,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadNumber: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2441,28 +2441,28 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadNumber: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = appendComma(bb) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumber: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2475,17 +2475,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyNumber: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToNumber(p + code.Offset) + v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -2498,10 +2498,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadNumberString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2514,19 +2514,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadNumberString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -2534,10 +2534,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2550,17 +2550,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyNumberString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToNumber(p + code.Offset) + v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -2577,7 +2577,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2588,20 +2588,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadNumberPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2617,7 +2617,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2628,19 +2628,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2654,7 +2654,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2665,20 +2665,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadNumberPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2695,7 +2695,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2706,19 +2706,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2732,10 +2732,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2748,25 +2748,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadArray, encoder.OpStructHeadSlice: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - p += code.Offset + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmptyArray: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2779,25 +2779,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyArray: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - p += code.Offset + p += uintptr(code.Offset) b = appendStructKey(ctx, code, b) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmptySlice: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2810,17 +2810,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptySlice: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - p += code.Offset + p += uintptr(code.Offset) slice := ptrToSlice(p) if slice.Len == 0 { code = code.NextField @@ -2832,7 +2832,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2843,20 +2843,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2869,7 +2869,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyArrayPtr, encoder.OpStructPtrHeadOmitEmptySlicePtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2880,19 +2880,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyArrayPtr, encoder.OpStructHeadOmitEmptySlicePtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { code = code.NextField @@ -2904,7 +2904,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMap: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2915,27 +2915,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMap: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if p != 0 && code.Indirect { - p = ptrToPtr(p + code.Offset) + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) } code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmptyMap: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2946,19 +2946,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMap: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if p != 0 && code.Indirect { - p = ptrToPtr(p + code.Offset) + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) } if maplen(ptrToUnsafePtr(p)) == 0 { code = code.NextField @@ -2970,7 +2970,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMapPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2981,15 +2981,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMapPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) @@ -2999,13 +2999,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.NextField break } - p = ptrToPtr(p + code.Offset) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 { b = appendNull(b) b = appendComma(b) code = code.NextField } else { - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p, code.PtrNum) } code = code.Next @@ -3014,7 +3014,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMapPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3025,26 +3025,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMapPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } if p == 0 { code = code.NextField break } - p = ptrToPtr(p + code.Offset) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 { code = code.NextField } else { - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p, code.PtrNum) } b = appendStructKey(ctx, code, b) @@ -3054,37 +3054,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadMarshalJSON: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadMarshalJSON { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -3098,37 +3098,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { + p = ptrToPtr(p + uintptr(code.Offset)) } } iface := ptrToInterface(code, p) - if code.Nilcheck && encoder.IsNilForMarshaler(iface) { + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -3143,7 +3143,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3154,20 +3154,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -3183,7 +3183,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3194,18 +3194,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } if p == 0 { @@ -3223,37 +3223,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalText: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadMarshalText: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadMarshalText { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -3267,36 +3267,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -3311,7 +3311,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3322,20 +3322,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMarshalTextPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -3351,7 +3351,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3362,18 +3362,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } if p == 0 { @@ -3389,16 +3389,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructField: - if !code.AnonymousKey { + if code.Flags&encoder.AnonymousKeyFlags == 0 { b = appendStructKey(ctx, code, b) } - p := load(ctxptr, code.HeadIdx) + code.Offset + p := load(ctxptr, code.Idx) + uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmpty: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if ptrToPtr(p) == 0 && code.IsNextOpPtrType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -3406,15 +3406,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, p) } case encoder.OpStructFieldInt: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyInt: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, u64, code) @@ -3422,17 +3422,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldIntString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyIntString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3442,8 +3442,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3453,8 +3453,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p), code) @@ -3462,8 +3462,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3475,8 +3475,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3486,15 +3486,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUint: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUint: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, u64, code) @@ -3502,17 +3502,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUintString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUintString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3522,8 +3522,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3533,8 +3533,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p), code) @@ -3542,8 +3542,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3555,8 +3555,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3566,14 +3566,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, v) @@ -3581,16 +3581,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32String: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3600,8 +3600,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3611,8 +3611,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, ptrToFloat32(p)) @@ -3620,8 +3620,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3633,8 +3633,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3644,9 +3644,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -3654,8 +3654,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -3666,8 +3666,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -3678,8 +3678,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -3692,8 +3692,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3709,8 +3709,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) v := ptrToFloat64(p) @@ -3722,8 +3722,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3739,8 +3739,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3754,14 +3754,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) + b = appendString(b, ptrToString(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, v) @@ -3769,15 +3769,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldStringString: - p := load(ctxptr, code.HeadIdx) - s := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + s := ptrToString(p + uintptr(code.Offset)) b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, s))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyStringString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, v))) @@ -3785,8 +3785,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3796,8 +3796,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, ptrToString(p)) @@ -3805,8 +3805,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3816,8 +3816,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) @@ -3825,14 +3825,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBool: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBool: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = appendBool(b, v) @@ -3840,16 +3840,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBoolString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolString: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3859,8 +3859,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3870,8 +3870,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendBool(b, ptrToBool(p)) @@ -3879,8 +3879,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3892,8 +3892,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3903,14 +3903,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBytes: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) + b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, v) @@ -3918,8 +3918,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3929,8 +3929,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, ptrToBytes(p)) @@ -3938,17 +3938,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumber: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = appendComma(bb) code = code.Next case encoder.OpStructFieldOmitEmptyNumber: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, v) @@ -3959,10 +3959,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumberString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -3970,8 +3970,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberString: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3984,8 +3984,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3999,8 +3999,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, ptrToNumber(p)) @@ -4011,8 +4011,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -4027,8 +4027,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4041,13 +4041,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldMarshalJSON: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p += code.Offset - if code.IsNilableType { + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -4059,17 +4059,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSON: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if code.IsNilableType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField break } iface := ptrToInterface(code, p) - if code.Nilcheck && encoder.IsNilForMarshaler(iface) { + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { code = code.NextField break } @@ -4081,9 +4081,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) code = code.Next case encoder.OpStructFieldMarshalJSONPtr: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4096,8 +4096,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSONPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -4108,13 +4108,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldMarshalText: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p += code.Offset - if code.IsNilableType { + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -4126,12 +4126,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalText: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if code.IsNilableType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField break } @@ -4143,9 +4143,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) code = code.Next case encoder.OpStructFieldMarshalTextPtr: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4158,8 +4158,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalTextPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -4171,25 +4171,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructFieldArray: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyArray: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldArrayPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyArrayPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) code = code.Next @@ -4199,13 +4199,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldSlice: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptySlice: - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) slice := ptrToSlice(p) if slice.Len == 0 { code = code.NextField @@ -4216,13 +4216,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldSlicePtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptySlicePtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) code = code.Next @@ -4232,13 +4232,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldMap: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyMap: - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 { code = code.NextField } else { @@ -4248,16 +4248,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldMapPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) if p != 0 { p = ptrToNPtr(p, code.PtrNum) } code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyMapPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) if p != 0 { p = ptrToNPtr(p, code.PtrNum) } @@ -4270,14 +4270,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldStruct: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyStruct: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if ptrToPtr(p) == 0 && code.IsNextOpPtrType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -4290,15 +4290,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEndSkipLast(ctx, code, b) code = code.Next case encoder.OpStructEndInt: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyInt: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, u64, code) @@ -4308,17 +4308,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndIntString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4331,8 +4331,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndIntPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4341,8 +4341,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p), code) @@ -4353,8 +4353,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndIntPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4365,8 +4365,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4378,15 +4378,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndUint: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUint: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, u64, code) @@ -4396,17 +4396,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndUintString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4419,8 +4419,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndUintPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4429,8 +4429,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p), code) @@ -4441,8 +4441,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndUintPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4453,8 +4453,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4466,14 +4466,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat32: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, v) @@ -4483,16 +4483,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat32String: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4505,8 +4505,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat32Ptr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4515,8 +4515,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, ptrToFloat32(p)) @@ -4527,8 +4527,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat32PtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4539,8 +4539,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4552,8 +4552,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -4562,8 +4562,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -4576,8 +4576,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -4588,8 +4588,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -4605,8 +4605,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat64Ptr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) b = appendStructEnd(ctx, code, b) @@ -4621,8 +4621,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) v := ptrToFloat64(p) @@ -4637,8 +4637,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat64PtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4653,8 +4653,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) v := ptrToFloat64(p) @@ -4670,14 +4670,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) + b = appendString(b, ptrToString(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, v) @@ -4687,15 +4687,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndStringString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - s := ptrToString(p + code.Offset) + s := ptrToString(p + uintptr(code.Offset)) b = appendString(b, string(appendString([]byte{}, s))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, v))) @@ -4706,8 +4706,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndStringPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4716,8 +4716,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, ptrToString(p)) @@ -4728,8 +4728,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndStringPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4738,8 +4738,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) @@ -4749,14 +4749,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndBool: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBool: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = appendBool(b, v) @@ -4766,16 +4766,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndBoolString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBoolString: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4788,8 +4788,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBoolPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4798,8 +4798,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendBool(b, ptrToBool(p)) @@ -4810,8 +4810,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBoolPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4822,8 +4822,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4835,14 +4835,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndBytes: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) + b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, v) @@ -4853,8 +4853,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBytesPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4863,8 +4863,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, ptrToBytes(p)) @@ -4874,17 +4874,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndNumber: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = appendStructEnd(ctx, code, bb) code = code.Next case encoder.OpStructEndOmitEmptyNumber: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, v) @@ -4897,10 +4897,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndNumberString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -4908,8 +4908,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberString: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4925,8 +4925,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndNumberPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4939,8 +4939,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, ptrToNumber(p)) @@ -4954,8 +4954,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndNumberPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4969,8 +4969,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') diff --git a/internal/encoder/vm_escaped_indent/debug_vm.go b/internal/encoder/vm_escaped_indent/debug_vm.go index 970ab47..2654630 100644 --- a/internal/encoder/vm_escaped_indent/debug_vm.go +++ b/internal/encoder/vm_escaped_indent/debug_vm.go @@ -14,7 +14,7 @@ func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, fmt.Println(codeSet.Type) fmt.Printf("\n") fmt.Println("* [ALL OPCODE]") - fmt.Println(codeSet.Code.Dump()) + fmt.Println(ctx.Code.Dump()) fmt.Printf("\n") fmt.Println("* [CONTEXT]") fmt.Printf("%+v\n", ctx) diff --git a/internal/encoder/vm_escaped_indent/util.go b/internal/encoder/vm_escaped_indent/util.go index 60d73e0..b1458ae 100644 --- a/internal/encoder/vm_escaped_indent/util.go +++ b/internal/encoder/vm_escaped_indent/util.go @@ -39,20 +39,20 @@ func errUnimplementedOp(op encoder.OpType) error { return fmt.Errorf("encoder (indent+escaped): opcode %s has not been implemented", op) } -func load(base uintptr, idx uintptr) uintptr { - addr := base + idx +func load(base uintptr, idx uint32) uintptr { + addr := base + uintptr(idx) return **(**uintptr)(unsafe.Pointer(&addr)) } -func store(base uintptr, idx uintptr, p uintptr) { - addr := base + idx +func store(base uintptr, idx uint32, p uintptr) { + addr := base + uintptr(idx) **(**uintptr)(unsafe.Pointer(&addr)) = p } -func loadNPtr(base uintptr, idx uintptr, ptrNum int) uintptr { - addr := base + idx +func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr { + addr := base + uintptr(idx) p := **(**uintptr)(unsafe.Pointer(&addr)) - for i := 0; i < ptrNum; i++ { + for i := uint8(0); i < ptrNum; i++ { if p == 0 { return 0 } @@ -72,8 +72,8 @@ func ptrToSlice(p uintptr) *runtime.SliceHeader { return *(**runtime.SliceHeader func ptrToPtr(p uintptr) uintptr { return uintptr(**(**unsafe.Pointer)(unsafe.Pointer(&p))) } -func ptrToNPtr(p uintptr, ptrNum int) uintptr { - for i := 0; i < ptrNum; i++ { +func ptrToNPtr(p uintptr, ptrNum uint8) uintptr { + for i := uint8(0); i < ptrNum; i++ { if p == 0 { return 0 } @@ -137,6 +137,7 @@ func appendInterface(ctx *encoder.RuntimeContext, codeSet *encoder.OpcodeSet, op oldBaseIndent := ctx.BaseIndent ctx.BaseIndent = code.Indent + ctx.Code = ifaceCodeSet.EscapeKeyCode bb, err := Run(ctx, b, ifaceCodeSet, opt) if err != nil { return nil, err @@ -204,7 +205,7 @@ func appendStructHead(b []byte) []byte { func appendStructKey(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { b = appendIndent(ctx, b, code.Indent) - b = append(b, code.EscapedKey...) + b = append(b, code.Key...) return append(b, ' ') } @@ -225,7 +226,7 @@ func appendStructEndSkipLast(ctx *encoder.RuntimeContext, code *encoder.Opcode, } func restoreIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, ctxptr uintptr) { - ctx.BaseIndent = int(load(ctxptr, code.Length)) + ctx.BaseIndent = uint32(load(ctxptr, code.Length)) } func storeIndent(ctxptr uintptr, code *encoder.Opcode, indent uintptr) { diff --git a/internal/encoder/vm_escaped_indent/vm.go b/internal/encoder/vm_escaped_indent/vm.go index 2288602..11ad8e6 100644 --- a/internal/encoder/vm_escaped_indent/vm.go +++ b/internal/encoder/vm_escaped_indent/vm.go @@ -13,7 +13,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt recursiveLevel := 0 ptrOffset := uintptr(0) ctxptr := ctx.Ptr() - code := codeSet.Code + code := ctx.Code for { switch code.Op { @@ -212,7 +212,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next break } - if code.IsNilableType && code.Indirect { + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { p = ptrToPtr(p) } bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -239,7 +239,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next break } - if code.IsNilableType && code.Indirect { + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { p = ptrToPtr(p) } bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -285,8 +285,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if idx < length { b = appendArrayElemIndent(ctx, code, b) store(ctxptr, code.ElemIdx, idx) - data := load(ctxptr, code.HeadIdx) - size := code.Size + data := load(ctxptr, code.Idx) + size := uintptr(code.Size) code = code.Next store(ctxptr, code.Idx, data+idx*size) } else { @@ -323,11 +323,11 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpArrayElem: idx := load(ctxptr, code.ElemIdx) idx++ - if idx < code.Length { + if idx < uintptr(code.Length) { b = appendArrayElemIndent(ctx, code, b) store(ctxptr, code.ElemIdx, idx) - p := load(ctxptr, code.HeadIdx) - size := code.Size + p := load(ctxptr, code.Idx) + size := uintptr(code.Size) code = code.Next store(ctxptr, code.Idx, p+idx*size) } else { @@ -508,7 +508,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHead: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -519,27 +519,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHead: p := load(ctxptr, code.Idx) - if p == 0 && (code.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if !code.AnonymousKey && len(code.Key) > 0 { + if (code.Flags&encoder.AnonymousKeyFlags) == 0 && len(code.Key) > 0 { b = appendStructKey(ctx, code, b) } - p += code.Offset + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmpty: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -550,19 +550,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmpty: p := load(ctxptr, code.Idx) - if p == 0 && (code.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - p += code.Offset - if p == 0 || (ptrToPtr(p) == 0 && code.IsNextOpPtrType) { + p += uintptr(code.Offset) + if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -570,10 +570,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, p) } case encoder.OpStructPtrHeadInt: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -586,25 +586,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadInt: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyInt: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -617,18 +617,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyInt: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -638,10 +638,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadIntString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -654,27 +654,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadIntString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -687,18 +687,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyIntString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -712,7 +712,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadIntPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -723,20 +723,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadIntPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -748,7 +748,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyIntPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -759,19 +759,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyIntPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -782,7 +782,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -793,20 +793,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadIntPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -820,7 +820,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -831,19 +831,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -854,10 +854,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadUint: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -870,25 +870,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadUint: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUint: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -901,18 +901,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyUint: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -922,10 +922,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadUintString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -938,27 +938,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadUintString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -971,18 +971,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyUintString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -996,7 +996,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadUintPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1007,20 +1007,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadUintPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1032,7 +1032,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyUintPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1043,19 +1043,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyUintPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1066,7 +1066,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1077,20 +1077,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadUintPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1104,7 +1104,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1115,19 +1115,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1138,10 +1138,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadFloat32: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1154,25 +1154,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat32: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1185,17 +1185,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat32: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat32(p + code.Offset) + v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1205,10 +1205,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadFloat32String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1221,27 +1221,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat32String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1254,17 +1254,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat32String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat32(p + code.Offset) + v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1278,7 +1278,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1289,20 +1289,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat32Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1314,7 +1314,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1325,19 +1325,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1348,7 +1348,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1359,20 +1359,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat32PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1386,7 +1386,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1397,19 +1397,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1420,10 +1420,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadFloat64: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1436,18 +1436,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat64: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) @@ -1455,10 +1455,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1471,17 +1471,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat64: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1494,10 +1494,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadFloat64String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1510,17 +1510,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat64String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -1531,10 +1531,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1547,17 +1547,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat64String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1574,7 +1574,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1585,20 +1585,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat64Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1614,7 +1614,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1625,19 +1625,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1652,7 +1652,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1663,20 +1663,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat64PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1694,7 +1694,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1705,19 +1705,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1732,10 +1732,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1748,25 +1748,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) + b = appendString(b, ptrToString(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1779,17 +1779,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToString(p + code.Offset) + v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -1799,10 +1799,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadStringString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1815,25 +1815,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadStringString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p+code.Offset)))) + b = appendString(b, string(appendString([]byte{}, ptrToString(p+uintptr(code.Offset))))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyStringString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1846,17 +1846,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyStringString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToString(p + code.Offset) + v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -1868,7 +1868,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadStringPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1879,20 +1879,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadStringPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1904,7 +1904,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyStringPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1915,19 +1915,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyStringPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1938,7 +1938,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1949,20 +1949,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadStringPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1974,7 +1974,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1985,19 +1985,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2006,10 +2006,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadBool: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2022,25 +2022,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBool: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBool: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2053,17 +2053,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBool: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToBool(p + code.Offset) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = appendBool(b, v) @@ -2073,10 +2073,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.NextField } case encoder.OpStructPtrHeadBoolString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2089,27 +2089,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBoolString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2122,17 +2122,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBoolString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToBool(p + code.Offset) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -2146,7 +2146,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadBoolPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2157,20 +2157,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBoolPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2182,7 +2182,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2193,19 +2193,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2216,7 +2216,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2227,20 +2227,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBoolPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2254,7 +2254,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2265,19 +2265,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2288,10 +2288,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadBytes: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2304,25 +2304,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBytes: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) + b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBytes: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2335,17 +2335,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBytes: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToBytes(p + code.Offset) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) == 0 { code = code.NextField } else { @@ -2357,7 +2357,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2368,20 +2368,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBytesPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2393,7 +2393,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2404,19 +2404,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2425,10 +2425,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadNumber: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2441,28 +2441,28 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadNumber: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = appendComma(bb) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumber: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2475,17 +2475,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyNumber: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToNumber(p + code.Offset) + v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -2498,10 +2498,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadNumberString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2514,19 +2514,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadNumberString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -2534,10 +2534,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2550,17 +2550,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyNumberString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToNumber(p + code.Offset) + v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -2577,7 +2577,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2588,20 +2588,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadNumberPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2617,7 +2617,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2628,19 +2628,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2654,7 +2654,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2665,20 +2665,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadNumberPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2695,7 +2695,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2706,19 +2706,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2732,10 +2732,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2748,25 +2748,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadArray, encoder.OpStructHeadSlice: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - p += code.Offset + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmptyArray: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2779,25 +2779,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyArray: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - p += code.Offset + p += uintptr(code.Offset) b = appendStructKey(ctx, code, b) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmptySlice: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2810,17 +2810,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptySlice: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - p += code.Offset + p += uintptr(code.Offset) slice := ptrToSlice(p) if slice.Len == 0 { code = code.NextField @@ -2832,7 +2832,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2843,20 +2843,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2869,7 +2869,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyArrayPtr, encoder.OpStructPtrHeadOmitEmptySlicePtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2880,19 +2880,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyArrayPtr, encoder.OpStructHeadOmitEmptySlicePtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { code = code.NextField @@ -2904,7 +2904,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMap: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2915,27 +2915,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMap: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if p != 0 && code.Indirect { - p = ptrToPtr(p + code.Offset) + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) } code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmptyMap: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2946,19 +2946,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMap: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if p != 0 && code.Indirect { - p = ptrToPtr(p + code.Offset) + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) } if maplen(ptrToUnsafePtr(p)) == 0 { code = code.NextField @@ -2970,7 +2970,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMapPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2981,15 +2981,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMapPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) @@ -2999,13 +2999,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.NextField break } - p = ptrToPtr(p + code.Offset) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 { b = appendNull(b) b = appendComma(b) code = code.NextField } else { - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p, code.PtrNum) } code = code.Next @@ -3014,7 +3014,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMapPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3025,26 +3025,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMapPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } if p == 0 { code = code.NextField break } - p = ptrToPtr(p + code.Offset) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 { code = code.NextField } else { - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p, code.PtrNum) } b = appendStructKey(ctx, code, b) @@ -3054,37 +3054,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadMarshalJSON: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadMarshalJSON { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -3098,37 +3098,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { + p = ptrToPtr(p + uintptr(code.Offset)) } } iface := ptrToInterface(code, p) - if code.Nilcheck && encoder.IsNilForMarshaler(iface) { + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -3143,7 +3143,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3154,20 +3154,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -3183,7 +3183,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3194,18 +3194,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } if p == 0 { @@ -3223,37 +3223,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalText: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadMarshalText: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadMarshalText { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -3267,36 +3267,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -3311,7 +3311,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3322,20 +3322,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMarshalTextPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -3351,7 +3351,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3362,18 +3362,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } if p == 0 { @@ -3389,16 +3389,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructField: - if !code.AnonymousKey { + if code.Flags&encoder.AnonymousKeyFlags == 0 { b = appendStructKey(ctx, code, b) } - p := load(ctxptr, code.HeadIdx) + code.Offset + p := load(ctxptr, code.Idx) + uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmpty: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if ptrToPtr(p) == 0 && code.IsNextOpPtrType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -3406,15 +3406,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, p) } case encoder.OpStructFieldInt: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyInt: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, u64, code) @@ -3422,17 +3422,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldIntString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyIntString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3442,8 +3442,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3453,8 +3453,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p), code) @@ -3462,8 +3462,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3475,8 +3475,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3486,15 +3486,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUint: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUint: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, u64, code) @@ -3502,17 +3502,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUintString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUintString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3522,8 +3522,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3533,8 +3533,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p), code) @@ -3542,8 +3542,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3555,8 +3555,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3566,14 +3566,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, v) @@ -3581,16 +3581,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32String: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3600,8 +3600,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3611,8 +3611,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, ptrToFloat32(p)) @@ -3620,8 +3620,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3633,8 +3633,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3644,9 +3644,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -3654,8 +3654,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -3666,8 +3666,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -3678,8 +3678,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -3692,8 +3692,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3709,8 +3709,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) v := ptrToFloat64(p) @@ -3722,8 +3722,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3739,8 +3739,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3754,14 +3754,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) + b = appendString(b, ptrToString(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, v) @@ -3769,15 +3769,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldStringString: - p := load(ctxptr, code.HeadIdx) - s := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + s := ptrToString(p + uintptr(code.Offset)) b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, s))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyStringString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, v))) @@ -3785,8 +3785,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3796,8 +3796,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, ptrToString(p)) @@ -3805,8 +3805,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3816,8 +3816,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) @@ -3825,14 +3825,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBool: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBool: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = appendBool(b, v) @@ -3840,16 +3840,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBoolString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolString: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3859,8 +3859,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3870,8 +3870,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendBool(b, ptrToBool(p)) @@ -3879,8 +3879,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3892,8 +3892,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3903,14 +3903,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBytes: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) + b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, v) @@ -3918,8 +3918,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3929,8 +3929,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, ptrToBytes(p)) @@ -3938,17 +3938,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumber: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = appendComma(bb) code = code.Next case encoder.OpStructFieldOmitEmptyNumber: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, v) @@ -3959,10 +3959,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumberString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -3970,8 +3970,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberString: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3984,8 +3984,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3999,8 +3999,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, ptrToNumber(p)) @@ -4011,8 +4011,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -4027,8 +4027,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4041,13 +4041,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldMarshalJSON: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p += code.Offset - if code.IsNilableType { + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -4059,17 +4059,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSON: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if code.IsNilableType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField break } iface := ptrToInterface(code, p) - if code.Nilcheck && encoder.IsNilForMarshaler(iface) { + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { code = code.NextField break } @@ -4081,9 +4081,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) code = code.Next case encoder.OpStructFieldMarshalJSONPtr: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4096,8 +4096,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSONPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -4108,13 +4108,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldMarshalText: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p += code.Offset - if code.IsNilableType { + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -4126,12 +4126,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalText: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if code.IsNilableType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField break } @@ -4143,9 +4143,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) code = code.Next case encoder.OpStructFieldMarshalTextPtr: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4158,8 +4158,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalTextPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -4171,25 +4171,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructFieldArray: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyArray: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldArrayPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyArrayPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) code = code.Next @@ -4199,13 +4199,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldSlice: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptySlice: - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) slice := ptrToSlice(p) if slice.Len == 0 { code = code.NextField @@ -4216,13 +4216,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldSlicePtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptySlicePtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) code = code.Next @@ -4232,13 +4232,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldMap: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyMap: - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 { code = code.NextField } else { @@ -4248,16 +4248,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldMapPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) if p != 0 { p = ptrToNPtr(p, code.PtrNum) } code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyMapPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) if p != 0 { p = ptrToNPtr(p, code.PtrNum) } @@ -4270,14 +4270,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldStruct: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyStruct: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if ptrToPtr(p) == 0 && code.IsNextOpPtrType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -4290,15 +4290,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEndSkipLast(ctx, code, b) code = code.Next case encoder.OpStructEndInt: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyInt: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, u64, code) @@ -4308,17 +4308,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndIntString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4331,8 +4331,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndIntPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4341,8 +4341,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p), code) @@ -4353,8 +4353,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndIntPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4365,8 +4365,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4378,15 +4378,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndUint: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUint: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, u64, code) @@ -4396,17 +4396,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndUintString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4419,8 +4419,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndUintPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4429,8 +4429,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p), code) @@ -4441,8 +4441,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndUintPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4453,8 +4453,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4466,14 +4466,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat32: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, v) @@ -4483,16 +4483,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat32String: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4505,8 +4505,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat32Ptr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4515,8 +4515,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, ptrToFloat32(p)) @@ -4527,8 +4527,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat32PtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4539,8 +4539,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4552,8 +4552,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -4562,8 +4562,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -4576,8 +4576,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -4588,8 +4588,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -4605,8 +4605,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat64Ptr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) b = appendStructEnd(ctx, code, b) @@ -4621,8 +4621,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) v := ptrToFloat64(p) @@ -4637,8 +4637,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat64PtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4653,8 +4653,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) v := ptrToFloat64(p) @@ -4670,14 +4670,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) + b = appendString(b, ptrToString(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, v) @@ -4687,15 +4687,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndStringString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - s := ptrToString(p + code.Offset) + s := ptrToString(p + uintptr(code.Offset)) b = appendString(b, string(appendString([]byte{}, s))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, v))) @@ -4706,8 +4706,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndStringPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4716,8 +4716,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, ptrToString(p)) @@ -4728,8 +4728,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndStringPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4738,8 +4738,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) @@ -4749,14 +4749,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndBool: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBool: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = appendBool(b, v) @@ -4766,16 +4766,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndBoolString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBoolString: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4788,8 +4788,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBoolPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4798,8 +4798,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendBool(b, ptrToBool(p)) @@ -4810,8 +4810,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBoolPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4822,8 +4822,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4835,14 +4835,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndBytes: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) + b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, v) @@ -4853,8 +4853,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBytesPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4863,8 +4863,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, ptrToBytes(p)) @@ -4874,17 +4874,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndNumber: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = appendStructEnd(ctx, code, bb) code = code.Next case encoder.OpStructEndOmitEmptyNumber: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, v) @@ -4897,10 +4897,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndNumberString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -4908,8 +4908,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberString: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4925,8 +4925,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndNumberPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4939,8 +4939,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, ptrToNumber(p)) @@ -4954,8 +4954,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndNumberPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4969,8 +4969,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') diff --git a/internal/encoder/vm_indent/debug_vm.go b/internal/encoder/vm_indent/debug_vm.go index 4b78e9e..4dc9ee8 100644 --- a/internal/encoder/vm_indent/debug_vm.go +++ b/internal/encoder/vm_indent/debug_vm.go @@ -14,7 +14,7 @@ func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, fmt.Println(codeSet.Type) fmt.Printf("\n") fmt.Println("* [ALL OPCODE]") - fmt.Println(codeSet.Code.Dump()) + fmt.Println(ctx.Code.Dump()) fmt.Printf("\n") fmt.Println("* [CONTEXT]") fmt.Printf("%+v\n", ctx) diff --git a/internal/encoder/vm_indent/util.go b/internal/encoder/vm_indent/util.go index d73fb7b..ae358f2 100644 --- a/internal/encoder/vm_indent/util.go +++ b/internal/encoder/vm_indent/util.go @@ -39,20 +39,20 @@ func errUnimplementedOp(op encoder.OpType) error { return fmt.Errorf("encoder (indent): opcode %s has not been implemented", op) } -func load(base uintptr, idx uintptr) uintptr { - addr := base + idx +func load(base uintptr, idx uint32) uintptr { + addr := base + uintptr(idx) return **(**uintptr)(unsafe.Pointer(&addr)) } -func store(base uintptr, idx uintptr, p uintptr) { - addr := base + idx +func store(base uintptr, idx uint32, p uintptr) { + addr := base + uintptr(idx) **(**uintptr)(unsafe.Pointer(&addr)) = p } -func loadNPtr(base uintptr, idx uintptr, ptrNum int) uintptr { - addr := base + idx +func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr { + addr := base + uintptr(idx) p := **(**uintptr)(unsafe.Pointer(&addr)) - for i := 0; i < ptrNum; i++ { + for i := uint8(0); i < ptrNum; i++ { if p == 0 { return 0 } @@ -72,8 +72,8 @@ func ptrToSlice(p uintptr) *runtime.SliceHeader { return *(**runtime.SliceHeader func ptrToPtr(p uintptr) uintptr { return uintptr(**(**unsafe.Pointer)(unsafe.Pointer(&p))) } -func ptrToNPtr(p uintptr, ptrNum int) uintptr { - for i := 0; i < ptrNum; i++ { +func ptrToNPtr(p uintptr, ptrNum uint8) uintptr { + for i := uint8(0); i < ptrNum; i++ { if p == 0 { return 0 } @@ -137,6 +137,7 @@ func appendInterface(ctx *encoder.RuntimeContext, codeSet *encoder.OpcodeSet, op oldBaseIndent := ctx.BaseIndent ctx.BaseIndent = code.Indent + ctx.Code = ifaceCodeSet.NoescapeKeyCode bb, err := Run(ctx, b, ifaceCodeSet, opt) if err != nil { return nil, err @@ -225,7 +226,7 @@ func appendStructEndSkipLast(ctx *encoder.RuntimeContext, code *encoder.Opcode, } func restoreIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, ctxptr uintptr) { - ctx.BaseIndent = int(load(ctxptr, code.Length)) + ctx.BaseIndent = uint32(load(ctxptr, code.Length)) } func storeIndent(ctxptr uintptr, code *encoder.Opcode, indent uintptr) { diff --git a/internal/encoder/vm_indent/vm.go b/internal/encoder/vm_indent/vm.go index b470ada..b165f7b 100644 --- a/internal/encoder/vm_indent/vm.go +++ b/internal/encoder/vm_indent/vm.go @@ -13,7 +13,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt recursiveLevel := 0 ptrOffset := uintptr(0) ctxptr := ctx.Ptr() - code := codeSet.Code + code := ctx.Code for { switch code.Op { @@ -212,7 +212,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next break } - if code.IsNilableType && code.Indirect { + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { p = ptrToPtr(p) } bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -239,7 +239,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next break } - if code.IsNilableType && code.Indirect { + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { p = ptrToPtr(p) } bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -285,8 +285,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if idx < length { b = appendArrayElemIndent(ctx, code, b) store(ctxptr, code.ElemIdx, idx) - data := load(ctxptr, code.HeadIdx) - size := code.Size + data := load(ctxptr, code.Idx) + size := uintptr(code.Size) code = code.Next store(ctxptr, code.Idx, data+idx*size) } else { @@ -323,11 +323,11 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpArrayElem: idx := load(ctxptr, code.ElemIdx) idx++ - if idx < code.Length { + if idx < uintptr(code.Length) { b = appendArrayElemIndent(ctx, code, b) store(ctxptr, code.ElemIdx, idx) - p := load(ctxptr, code.HeadIdx) - size := code.Size + p := load(ctxptr, code.Idx) + size := uintptr(code.Size) code = code.Next store(ctxptr, code.Idx, p+idx*size) } else { @@ -508,7 +508,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHead: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -519,27 +519,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHead: p := load(ctxptr, code.Idx) - if p == 0 && (code.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if !code.AnonymousKey && len(code.Key) > 0 { + if (code.Flags&encoder.AnonymousKeyFlags) == 0 && len(code.Key) > 0 { b = appendStructKey(ctx, code, b) } - p += code.Offset + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmpty: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -550,19 +550,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmpty: p := load(ctxptr, code.Idx) - if p == 0 && (code.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - p += code.Offset - if p == 0 || (ptrToPtr(p) == 0 && code.IsNextOpPtrType) { + p += uintptr(code.Offset) + if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -570,10 +570,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, p) } case encoder.OpStructPtrHeadInt: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -586,25 +586,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadInt: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyInt: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -617,18 +617,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyInt: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -638,10 +638,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadIntString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -654,27 +654,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadIntString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -687,18 +687,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyIntString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -712,7 +712,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadIntPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -723,20 +723,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadIntPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -748,7 +748,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyIntPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -759,19 +759,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyIntPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -782,7 +782,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -793,20 +793,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadIntPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -820,7 +820,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -831,19 +831,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -854,10 +854,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadUint: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -870,25 +870,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadUint: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUint: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -901,18 +901,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyUint: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -922,10 +922,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadUintString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -938,27 +938,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadUintString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -971,18 +971,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyUintString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { @@ -996,7 +996,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadUintPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1007,20 +1007,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadUintPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1032,7 +1032,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyUintPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1043,19 +1043,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyUintPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1066,7 +1066,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1077,20 +1077,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadUintPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1104,7 +1104,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1115,19 +1115,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1138,10 +1138,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadFloat32: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1154,25 +1154,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat32: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1185,17 +1185,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat32: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat32(p + code.Offset) + v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1205,10 +1205,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadFloat32String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1221,27 +1221,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat32String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1254,17 +1254,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat32String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat32(p + code.Offset) + v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1278,7 +1278,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1289,20 +1289,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat32Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1314,7 +1314,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1325,19 +1325,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1348,7 +1348,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1359,20 +1359,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat32PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1386,7 +1386,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1397,19 +1397,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1420,10 +1420,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadFloat64: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1436,18 +1436,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat64: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) @@ -1455,10 +1455,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1471,17 +1471,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat64: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1494,10 +1494,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadFloat64String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1510,17 +1510,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat64String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -1531,10 +1531,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1547,17 +1547,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat64String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1574,7 +1574,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1585,20 +1585,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat64Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1614,7 +1614,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1625,19 +1625,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1652,7 +1652,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1663,20 +1663,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat64PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1694,7 +1694,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1705,19 +1705,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1732,10 +1732,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1748,25 +1748,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) + b = appendString(b, ptrToString(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1779,17 +1779,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToString(p + code.Offset) + v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -1799,10 +1799,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadStringString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1815,25 +1815,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadStringString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p+code.Offset)))) + b = appendString(b, string(appendString([]byte{}, ptrToString(p+uintptr(code.Offset))))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyStringString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1846,17 +1846,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyStringString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToString(p + code.Offset) + v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -1868,7 +1868,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadStringPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1879,20 +1879,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadStringPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1904,7 +1904,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyStringPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1915,19 +1915,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyStringPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1938,7 +1938,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1949,20 +1949,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadStringPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -1974,7 +1974,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -1985,19 +1985,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2006,10 +2006,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadBool: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2022,25 +2022,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBool: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBool: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2053,17 +2053,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBool: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToBool(p + code.Offset) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = appendBool(b, v) @@ -2073,10 +2073,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.NextField } case encoder.OpStructPtrHeadBoolString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2089,27 +2089,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBoolString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2122,17 +2122,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBoolString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToBool(p + code.Offset) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -2146,7 +2146,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadBoolPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2157,20 +2157,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBoolPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2182,7 +2182,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2193,19 +2193,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2216,7 +2216,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2227,20 +2227,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBoolPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2254,7 +2254,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2265,19 +2265,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2288,10 +2288,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadBytes: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2304,25 +2304,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBytes: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) + b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBytes: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2335,17 +2335,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBytes: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToBytes(p + code.Offset) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) == 0 { code = code.NextField } else { @@ -2357,7 +2357,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2368,20 +2368,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBytesPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2393,7 +2393,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2404,19 +2404,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2425,10 +2425,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadNumber: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2441,28 +2441,28 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadNumber: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = appendComma(bb) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumber: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2475,17 +2475,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyNumber: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToNumber(p + code.Offset) + v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -2498,10 +2498,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructPtrHeadNumberString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2514,19 +2514,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadNumberString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -2534,10 +2534,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2550,17 +2550,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyNumberString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - v := ptrToNumber(p + code.Offset) + v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { @@ -2577,7 +2577,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2588,20 +2588,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadNumberPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2617,7 +2617,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2628,19 +2628,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2654,7 +2654,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2665,20 +2665,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadNumberPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2695,7 +2695,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2706,19 +2706,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -2732,10 +2732,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2748,25 +2748,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadArray, encoder.OpStructHeadSlice: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - p += code.Offset + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmptyArray: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2779,25 +2779,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyArray: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - p += code.Offset + p += uintptr(code.Offset) b = appendStructKey(ctx, code, b) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmptySlice: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2810,17 +2810,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptySlice: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - p += code.Offset + p += uintptr(code.Offset) slice := ptrToSlice(p) if slice.Len == 0 { code = code.NextField @@ -2832,7 +2832,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2843,20 +2843,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -2869,7 +2869,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyArrayPtr, encoder.OpStructPtrHeadOmitEmptySlicePtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2880,19 +2880,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyArrayPtr, encoder.OpStructHeadOmitEmptySlicePtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { code = code.NextField @@ -2904,7 +2904,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMap: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2915,27 +2915,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMap: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if p != 0 && code.Indirect { - p = ptrToPtr(p + code.Offset) + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) } code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmptyMap: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2946,19 +2946,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMap: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if p != 0 && code.Indirect { - p = ptrToPtr(p + code.Offset) + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) } if maplen(ptrToUnsafePtr(p)) == 0 { code = code.NextField @@ -2970,7 +2970,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMapPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -2981,15 +2981,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMapPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) @@ -2999,13 +2999,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.NextField break } - p = ptrToPtr(p + code.Offset) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 { b = appendNull(b) b = appendComma(b) code = code.NextField } else { - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p, code.PtrNum) } code = code.Next @@ -3014,7 +3014,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMapPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3025,26 +3025,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMapPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } if p == 0 { code = code.NextField break } - p = ptrToPtr(p + code.Offset) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 { code = code.NextField } else { - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p, code.PtrNum) } b = appendStructKey(ctx, code, b) @@ -3054,37 +3054,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadMarshalJSON: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadMarshalJSON { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -3098,37 +3098,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { + p = ptrToPtr(p + uintptr(code.Offset)) } } iface := ptrToInterface(code, p) - if code.Nilcheck && encoder.IsNilForMarshaler(iface) { + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -3143,7 +3143,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3154,20 +3154,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -3183,7 +3183,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3194,18 +3194,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } if p == 0 { @@ -3223,37 +3223,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalText: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadMarshalText: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadMarshalText { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -3267,36 +3267,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough case encoder.OpStructHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -3311,7 +3311,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3322,20 +3322,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMarshalTextPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { b = appendNull(b) @@ -3351,7 +3351,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } @@ -3362,18 +3362,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendNull(b) b = appendComma(b) } code = code.End.Next break } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } - if !code.AnonymousHead { + if code.Flags&encoder.AnonymousHeadFlags == 0 { b = appendStructHead(b) } if p == 0 { @@ -3389,16 +3389,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next } case encoder.OpStructField: - if !code.AnonymousKey { + if code.Flags&encoder.AnonymousKeyFlags == 0 { b = appendStructKey(ctx, code, b) } - p := load(ctxptr, code.HeadIdx) + code.Offset + p := load(ctxptr, code.Idx) + uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmpty: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if ptrToPtr(p) == 0 && code.IsNextOpPtrType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -3406,15 +3406,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, p) } case encoder.OpStructFieldInt: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyInt: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, u64, code) @@ -3422,17 +3422,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldIntString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyIntString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3442,8 +3442,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3453,8 +3453,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p), code) @@ -3462,8 +3462,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3475,8 +3475,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3486,15 +3486,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUint: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUint: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, u64, code) @@ -3502,17 +3502,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUintString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUintString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3522,8 +3522,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3533,8 +3533,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p), code) @@ -3542,8 +3542,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3555,8 +3555,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3566,14 +3566,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, v) @@ -3581,16 +3581,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32String: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3600,8 +3600,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3611,8 +3611,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, ptrToFloat32(p)) @@ -3620,8 +3620,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3633,8 +3633,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3644,9 +3644,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -3654,8 +3654,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -3666,8 +3666,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -3678,8 +3678,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -3692,8 +3692,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3709,8 +3709,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) v := ptrToFloat64(p) @@ -3722,8 +3722,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3739,8 +3739,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3754,14 +3754,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) + b = appendString(b, ptrToString(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, v) @@ -3769,15 +3769,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldStringString: - p := load(ctxptr, code.HeadIdx) - s := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + s := ptrToString(p + uintptr(code.Offset)) b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, s))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyStringString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, v))) @@ -3785,8 +3785,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3796,8 +3796,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, ptrToString(p)) @@ -3805,8 +3805,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3816,8 +3816,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) @@ -3825,14 +3825,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBool: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBool: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = appendBool(b, v) @@ -3840,16 +3840,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBoolString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolString: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3859,8 +3859,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3870,8 +3870,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendBool(b, ptrToBool(p)) @@ -3879,8 +3879,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3892,8 +3892,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3903,14 +3903,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBytes: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) + b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, v) @@ -3918,8 +3918,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3929,8 +3929,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, ptrToBytes(p)) @@ -3938,17 +3938,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumber: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = appendComma(bb) code = code.Next case encoder.OpStructFieldOmitEmptyNumber: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, v) @@ -3959,10 +3959,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumberString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -3970,8 +3970,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberString: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3984,8 +3984,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -3999,8 +3999,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, ptrToNumber(p)) @@ -4011,8 +4011,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { b = appendNull(b) @@ -4027,8 +4027,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4041,13 +4041,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldMarshalJSON: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p += code.Offset - if code.IsNilableType { + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -4059,17 +4059,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSON: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if code.IsNilableType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField break } iface := ptrToInterface(code, p) - if code.Nilcheck && encoder.IsNilForMarshaler(iface) { + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { code = code.NextField break } @@ -4081,9 +4081,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) code = code.Next case encoder.OpStructFieldMarshalJSONPtr: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4096,8 +4096,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSONPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) @@ -4108,13 +4108,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructFieldMarshalText: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p += code.Offset - if code.IsNilableType { + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { b = appendNull(b) } else { bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -4126,12 +4126,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalText: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if code.IsNilableType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField break } @@ -4143,9 +4143,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) code = code.Next case encoder.OpStructFieldMarshalTextPtr: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4158,8 +4158,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalTextPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) @@ -4171,25 +4171,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructFieldArray: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyArray: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldArrayPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyArrayPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) code = code.Next @@ -4199,13 +4199,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldSlice: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptySlice: - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) slice := ptrToSlice(p) if slice.Len == 0 { code = code.NextField @@ -4216,13 +4216,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldSlicePtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptySlicePtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) code = code.Next @@ -4232,13 +4232,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldMap: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyMap: - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 { code = code.NextField } else { @@ -4248,16 +4248,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldMapPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) if p != 0 { p = ptrToNPtr(p, code.PtrNum) } code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyMapPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) if p != 0 { p = ptrToNPtr(p, code.PtrNum) } @@ -4270,14 +4270,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldStruct: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyStruct: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if ptrToPtr(p) == 0 && code.IsNextOpPtrType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -4290,15 +4290,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEndSkipLast(ctx, code, b) code = code.Next case encoder.OpStructEndInt: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyInt: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, u64, code) @@ -4308,17 +4308,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndIntString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4331,8 +4331,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndIntPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4341,8 +4341,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendInt(b, ptrToUint64(p), code) @@ -4353,8 +4353,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndIntPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4365,8 +4365,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4378,15 +4378,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndUint: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUint: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, u64, code) @@ -4396,17 +4396,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndUintString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4419,8 +4419,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndUintPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4429,8 +4429,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendUint(b, ptrToUint64(p), code) @@ -4441,8 +4441,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndUintPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4453,8 +4453,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4466,14 +4466,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat32: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, v) @@ -4483,16 +4483,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat32String: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4505,8 +4505,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat32Ptr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4515,8 +4515,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendFloat32(b, ptrToFloat32(p)) @@ -4527,8 +4527,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat32PtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4539,8 +4539,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4552,8 +4552,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -4562,8 +4562,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -4576,8 +4576,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } @@ -4588,8 +4588,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat64(p + uintptr(code.Offset)) if v != 0 { if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) @@ -4605,8 +4605,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat64Ptr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) b = appendStructEnd(ctx, code, b) @@ -4621,8 +4621,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) v := ptrToFloat64(p) @@ -4637,8 +4637,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat64PtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4653,8 +4653,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) v := ptrToFloat64(p) @@ -4670,14 +4670,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) + b = appendString(b, ptrToString(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, v) @@ -4687,15 +4687,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndStringString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - s := ptrToString(p + code.Offset) + s := ptrToString(p + uintptr(code.Offset)) b = appendString(b, string(appendString([]byte{}, s))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, v))) @@ -4706,8 +4706,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndStringPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4716,8 +4716,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, ptrToString(p)) @@ -4728,8 +4728,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndStringPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4738,8 +4738,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) @@ -4749,14 +4749,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndBool: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBool: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = appendBool(b, v) @@ -4766,16 +4766,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndBoolString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBoolString: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4788,8 +4788,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBoolPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4798,8 +4798,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendBool(b, ptrToBool(p)) @@ -4810,8 +4810,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBoolPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4822,8 +4822,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4835,14 +4835,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndBytes: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) + b = appendByteSlice(b, ptrToBytes(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, v) @@ -4853,8 +4853,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBytesPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4863,8 +4863,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = appendByteSlice(b, ptrToBytes(p)) @@ -4874,17 +4874,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndNumber: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = appendStructEnd(ctx, code, bb) code = code.Next case encoder.OpStructEndOmitEmptyNumber: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, v) @@ -4897,10 +4897,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndNumberString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -4908,8 +4908,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberString: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -4925,8 +4925,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndNumberPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4939,8 +4939,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) bb, err := appendNumber(b, ptrToNumber(p)) @@ -4954,8 +4954,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndNumberPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { b = appendNull(b) } else { @@ -4969,8 +4969,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') diff --git a/size_test.go b/size_test.go new file mode 100644 index 0000000..a57d663 --- /dev/null +++ b/size_test.go @@ -0,0 +1,18 @@ +package json + +import ( + "testing" + "unsafe" + + "github.com/goccy/go-json/internal/encoder" +) + +func TestOpcodeSize(t *testing.T) { + const uintptrSize = 4 << (^uintptr(0) >> 63) + if uintptrSize == 8 { + size := unsafe.Sizeof(encoder.Opcode{}) + if size != 128 { + t.Fatalf("unexpected opcode size: expected 128bytes but got %dbytes", size) + } + } +}