diff --git a/internal/cmd/generator/main.go b/internal/cmd/generator/main.go index 883b44a..b681fbb 100644 --- a/internal/cmd/generator/main.go +++ b/internal/cmd/generator/main.go @@ -100,7 +100,7 @@ func (t OpType) HeadToPtrHead() OpType { } suffix := "PtrHead"+t.String()[idx+len("Head"):] - const toPtrOffset = 3 + const toPtrOffset = 2 if strings.Contains(OpType(int(t) + toPtrOffset).String(), suffix) { return OpType(int(t) + toPtrOffset) } @@ -116,14 +116,6 @@ func (t OpType) HeadToOmitEmptyHead() OpType { return t } -func (t OpType) HeadToStringTagHead() OpType { - const toStringTagOffset = 2 - if strings.Contains(OpType(int(t) + toStringTagOffset).String(), "StringTag") { - return OpType(int(t) + toStringTagOffset) - } - return t -} - func (t OpType) PtrHeadToHead() OpType { idx := strings.Index(t.String(), "Ptr") if idx == -1 { @@ -131,7 +123,7 @@ func (t OpType) PtrHeadToHead() OpType { } suffix := t.String()[idx+len("Ptr"):] - const toPtrOffset = 3 + const toPtrOffset = 2 if strings.Contains(OpType(int(t) - toPtrOffset).String(), suffix) { return OpType(int(t) - toPtrOffset) } @@ -144,10 +136,10 @@ func (t OpType) FieldToEnd() OpType { return t } suffix := t.String()[idx+len("Field"):] - if suffix == "" || suffix == "OmitEmpty" || suffix == "StringTag" { + if suffix == "" || suffix == "OmitEmpty" { return t } - const toEndOffset = 3 + const toEndOffset = 2 if strings.Contains(OpType(int(t) + toEndOffset).String(), "End"+suffix) { return OpType(int(t) + toEndOffset) } @@ -161,15 +153,6 @@ func (t OpType) FieldToOmitEmptyField() OpType { } return t } - -func (t OpType) FieldToStringTagField() OpType { - const toStringTagOffset = 2 - if strings.Contains(OpType(int(t) + toStringTagOffset).String(), "StringTag") { - return OpType(int(t) + toStringTagOffset) - } - return t -} - `) if err != nil { return err @@ -191,9 +174,10 @@ func (t OpType) FieldToStringTagField() OpType { primitiveTypes := []string{ "int", "uint", "float32", "float64", "bool", "string", "bytes", "number", "array", "map", "slice", "struct", "MarshalJSON", "MarshalText", - "intString", "uintString", + "intString", "uintString", "float32String", "float64String", "boolString", "stringString", "numberString", "intPtr", "uintPtr", "float32Ptr", "float64Ptr", "boolPtr", "stringPtr", "bytesPtr", "numberPtr", "arrayPtr", "mapPtr", "slicePtr", "marshalJSONPtr", "marshalTextPtr", "interfacePtr", + "intPtrString", "uintPtrString", "float32PtrString", "float64PtrString", "boolPtrString", "stringPtrString", "numberPtrString", } primitiveTypesUpper := []string{} for _, typ := range primitiveTypes { @@ -221,7 +205,7 @@ func (t OpType) FieldToStringTagField() OpType { } for _, typ := range append(primitiveTypesUpper, "") { for _, ptrOrNot := range []string{"", "Ptr"} { - for _, opt := range []string{"", "OmitEmpty", "StringTag"} { + for _, opt := range []string{"", "OmitEmpty"} { ptrOrNot := ptrOrNot opt := opt typ := typ @@ -240,7 +224,7 @@ func (t OpType) FieldToStringTagField() OpType { } } for _, typ := range append(primitiveTypesUpper, "") { - for _, opt := range []string{"", "OmitEmpty", "StringTag"} { + for _, opt := range []string{"", "OmitEmpty"} { opt := opt typ := typ @@ -254,7 +238,7 @@ func (t OpType) FieldToStringTagField() OpType { Code: "StructField", }) } - for _, opt := range []string{"", "OmitEmpty", "StringTag"} { + for _, opt := range []string{"", "OmitEmpty"} { opt := opt typ := typ diff --git a/internal/encoder/compiler.go b/internal/encoder/compiler.go index e55d7f6..3038c4b 100644 --- a/internal/encoder/compiler.go +++ b/internal/encoder/compiler.go @@ -1019,23 +1019,17 @@ func compileMapValue(ctx *compileContext) (*Opcode, error) { } func optimizeStructHeader(code *Opcode, tag *runtime.StructTag) OpType { - headType := code.ToHeaderType() - switch { - case tag.IsOmitEmpty: + headType := code.ToHeaderType(tag.IsString) + if tag.IsOmitEmpty { headType = headType.HeadToOmitEmptyHead() - case tag.IsString: - headType = headType.HeadToStringTagHead() } return headType } func optimizeStructField(code *Opcode, tag *runtime.StructTag) OpType { - fieldType := code.ToFieldType() - switch { - case tag.IsOmitEmpty: + fieldType := code.ToFieldType(tag.IsString) + if tag.IsOmitEmpty { fieldType = fieldType.FieldToOmitEmptyField() - case tag.IsString: - fieldType = fieldType.FieldToStringTagField() } return fieldType } diff --git a/internal/encoder/encoder.go b/internal/encoder/encoder.go index 7f6c294..b0cab28 100644 --- a/internal/encoder/encoder.go +++ b/internal/encoder/encoder.go @@ -41,38 +41,24 @@ func (t OpType) IsMultipleOpHead() bool { return true case OpStructHeadOmitEmptySlice: return true - case OpStructHeadStringTagSlice: - return true case OpStructHeadOmitEmptyArray: return true - case OpStructHeadStringTagArray: - return true case OpStructHeadOmitEmptyMap: return true - case OpStructHeadStringTagMap: - return true case OpStructHeadOmitEmptyStruct: return true - case OpStructHeadStringTag: - return true case OpStructHeadSlicePtr: return true case OpStructHeadOmitEmptySlicePtr: return true - case OpStructHeadStringTagSlicePtr: - return true case OpStructHeadArrayPtr: return true case OpStructHeadOmitEmptyArrayPtr: return true - case OpStructHeadStringTagArrayPtr: - return true case OpStructHeadMapPtr: return true case OpStructHeadOmitEmptyMapPtr: return true - case OpStructHeadStringTagMapPtr: - return true } return false } @@ -93,38 +79,24 @@ func (t OpType) IsMultipleOpField() bool { return true case OpStructFieldOmitEmptySlice: return true - case OpStructFieldStringTagSlice: - return true case OpStructFieldOmitEmptyArray: return true - case OpStructFieldStringTagArray: - return true case OpStructFieldOmitEmptyMap: return true - case OpStructFieldStringTagMap: - return true case OpStructFieldOmitEmptyStruct: return true - case OpStructFieldStringTag: - return true case OpStructFieldSlicePtr: return true case OpStructFieldOmitEmptySlicePtr: return true - case OpStructFieldStringTagSlicePtr: - return true case OpStructFieldArrayPtr: return true case OpStructFieldOmitEmptyArrayPtr: return true - case OpStructFieldStringTagArrayPtr: - return true case OpStructFieldMapPtr: return true case OpStructFieldOmitEmptyMapPtr: return true - case OpStructFieldStringTagMapPtr: - return true } return false } diff --git a/internal/encoder/opcode.go b/internal/encoder/opcode.go index 74f322d..0dfd6fb 100644 --- a/internal/encoder/opcode.go +++ b/internal/encoder/opcode.go @@ -68,35 +68,77 @@ func (c *Opcode) setMaskAndRshiftNum(bitSize uint8) { c.RshiftNum = rshitNum(bitSize) } -func (c *Opcode) ToHeaderType() OpType { +func (c *Opcode) ToHeaderType(isString bool) OpType { switch c.Op { case OpInt: + if isString { + return OpStructHeadIntString + } return OpStructHeadInt case OpIntPtr: + if isString { + return OpStructHeadIntPtrString + } return OpStructHeadIntPtr case OpUint: + if isString { + return OpStructHeadUintString + } return OpStructHeadUint case OpUintPtr: + if isString { + return OpStructHeadUintPtrString + } return OpStructHeadUintPtr case OpFloat32: + if isString { + return OpStructHeadFloat32String + } return OpStructHeadFloat32 case OpFloat32Ptr: + if isString { + return OpStructHeadFloat32PtrString + } return OpStructHeadFloat32Ptr case OpFloat64: + if isString { + return OpStructHeadFloat64String + } return OpStructHeadFloat64 case OpFloat64Ptr: + if isString { + return OpStructHeadFloat64PtrString + } return OpStructHeadFloat64Ptr case OpString: + if isString { + return OpStructHeadStringString + } return OpStructHeadString case OpStringPtr: + if isString { + return OpStructHeadStringPtrString + } return OpStructHeadStringPtr case OpNumber: + if isString { + return OpStructHeadNumberString + } return OpStructHeadNumber case OpNumberPtr: + if isString { + return OpStructHeadNumberPtrString + } return OpStructHeadNumberPtr case OpBool: + if isString { + return OpStructHeadBoolString + } return OpStructHeadBool case OpBoolPtr: + if isString { + return OpStructHeadBoolPtrString + } return OpStructHeadBoolPtr case OpBytes: return OpStructHeadBytes @@ -129,35 +171,77 @@ func (c *Opcode) ToHeaderType() OpType { return OpStructHead } -func (c *Opcode) ToFieldType() OpType { +func (c *Opcode) ToFieldType(isString bool) OpType { switch c.Op { case OpInt: + if isString { + return OpStructFieldIntString + } return OpStructFieldInt case OpIntPtr: + if isString { + return OpStructFieldIntPtrString + } return OpStructFieldIntPtr case OpUint: + if isString { + return OpStructFieldUintString + } return OpStructFieldUint case OpUintPtr: + if isString { + return OpStructFieldUintPtrString + } return OpStructFieldUintPtr case OpFloat32: + if isString { + return OpStructFieldFloat32String + } return OpStructFieldFloat32 case OpFloat32Ptr: + if isString { + return OpStructFieldFloat32PtrString + } return OpStructFieldFloat32Ptr case OpFloat64: + if isString { + return OpStructFieldFloat64String + } return OpStructFieldFloat64 case OpFloat64Ptr: + if isString { + return OpStructFieldFloat64PtrString + } return OpStructFieldFloat64Ptr case OpString: + if isString { + return OpStructFieldStringString + } return OpStructFieldString case OpStringPtr: + if isString { + return OpStructFieldStringPtrString + } return OpStructFieldStringPtr case OpNumber: + if isString { + return OpStructFieldNumberString + } return OpStructFieldNumber case OpNumberPtr: + if isString { + return OpStructFieldNumberPtrString + } return OpStructFieldNumberPtr case OpBool: + if isString { + return OpStructFieldBoolString + } return OpStructFieldBool case OpBoolPtr: + if isString { + return OpStructFieldBoolPtrString + } return OpStructFieldBoolPtr case OpBytes: return OpStructFieldBytes diff --git a/internal/encoder/optype.go b/internal/encoder/optype.go index a312b55..21ac345 100644 --- a/internal/encoder/optype.go +++ b/internal/encoder/optype.go @@ -22,7 +22,7 @@ const ( CodeStructEnd CodeType = 11 ) -var opTypeStrings = [416]string{ +var opTypeStrings = [400]string{ "End", "Interface", "Ptr", @@ -53,6 +53,11 @@ var opTypeStrings = [416]string{ "MarshalText", "IntString", "UintString", + "Float32String", + "Float64String", + "BoolString", + "StringString", + "NumberString", "IntPtr", "UintPtr", "Float32Ptr", @@ -67,803 +72,766 @@ var opTypeStrings = [416]string{ "MarshalJSONPtr", "MarshalTextPtr", "InterfacePtr", + "IntPtrString", + "UintPtrString", + "Float32PtrString", + "Float64PtrString", + "BoolPtrString", + "StringPtrString", + "NumberPtrString", "StructHeadInt", "StructHeadOmitEmptyInt", - "StructHeadStringTagInt", "StructPtrHeadInt", "StructPtrHeadOmitEmptyInt", - "StructPtrHeadStringTagInt", "StructHeadUint", "StructHeadOmitEmptyUint", - "StructHeadStringTagUint", "StructPtrHeadUint", "StructPtrHeadOmitEmptyUint", - "StructPtrHeadStringTagUint", "StructHeadFloat32", "StructHeadOmitEmptyFloat32", - "StructHeadStringTagFloat32", "StructPtrHeadFloat32", "StructPtrHeadOmitEmptyFloat32", - "StructPtrHeadStringTagFloat32", "StructHeadFloat64", "StructHeadOmitEmptyFloat64", - "StructHeadStringTagFloat64", "StructPtrHeadFloat64", "StructPtrHeadOmitEmptyFloat64", - "StructPtrHeadStringTagFloat64", "StructHeadBool", "StructHeadOmitEmptyBool", - "StructHeadStringTagBool", "StructPtrHeadBool", "StructPtrHeadOmitEmptyBool", - "StructPtrHeadStringTagBool", "StructHeadString", "StructHeadOmitEmptyString", - "StructHeadStringTagString", "StructPtrHeadString", "StructPtrHeadOmitEmptyString", - "StructPtrHeadStringTagString", "StructHeadBytes", "StructHeadOmitEmptyBytes", - "StructHeadStringTagBytes", "StructPtrHeadBytes", "StructPtrHeadOmitEmptyBytes", - "StructPtrHeadStringTagBytes", "StructHeadNumber", "StructHeadOmitEmptyNumber", - "StructHeadStringTagNumber", "StructPtrHeadNumber", "StructPtrHeadOmitEmptyNumber", - "StructPtrHeadStringTagNumber", "StructHeadArray", "StructHeadOmitEmptyArray", - "StructHeadStringTagArray", "StructPtrHeadArray", "StructPtrHeadOmitEmptyArray", - "StructPtrHeadStringTagArray", "StructHeadMap", "StructHeadOmitEmptyMap", - "StructHeadStringTagMap", "StructPtrHeadMap", "StructPtrHeadOmitEmptyMap", - "StructPtrHeadStringTagMap", "StructHeadSlice", "StructHeadOmitEmptySlice", - "StructHeadStringTagSlice", "StructPtrHeadSlice", "StructPtrHeadOmitEmptySlice", - "StructPtrHeadStringTagSlice", "StructHeadStruct", "StructHeadOmitEmptyStruct", - "StructHeadStringTagStruct", "StructPtrHeadStruct", "StructPtrHeadOmitEmptyStruct", - "StructPtrHeadStringTagStruct", "StructHeadMarshalJSON", "StructHeadOmitEmptyMarshalJSON", - "StructHeadStringTagMarshalJSON", "StructPtrHeadMarshalJSON", "StructPtrHeadOmitEmptyMarshalJSON", - "StructPtrHeadStringTagMarshalJSON", "StructHeadMarshalText", "StructHeadOmitEmptyMarshalText", - "StructHeadStringTagMarshalText", "StructPtrHeadMarshalText", "StructPtrHeadOmitEmptyMarshalText", - "StructPtrHeadStringTagMarshalText", "StructHeadIntString", "StructHeadOmitEmptyIntString", - "StructHeadStringTagIntString", "StructPtrHeadIntString", "StructPtrHeadOmitEmptyIntString", - "StructPtrHeadStringTagIntString", "StructHeadUintString", "StructHeadOmitEmptyUintString", - "StructHeadStringTagUintString", "StructPtrHeadUintString", "StructPtrHeadOmitEmptyUintString", - "StructPtrHeadStringTagUintString", + "StructHeadFloat32String", + "StructHeadOmitEmptyFloat32String", + "StructPtrHeadFloat32String", + "StructPtrHeadOmitEmptyFloat32String", + "StructHeadFloat64String", + "StructHeadOmitEmptyFloat64String", + "StructPtrHeadFloat64String", + "StructPtrHeadOmitEmptyFloat64String", + "StructHeadBoolString", + "StructHeadOmitEmptyBoolString", + "StructPtrHeadBoolString", + "StructPtrHeadOmitEmptyBoolString", + "StructHeadStringString", + "StructHeadOmitEmptyStringString", + "StructPtrHeadStringString", + "StructPtrHeadOmitEmptyStringString", + "StructHeadNumberString", + "StructHeadOmitEmptyNumberString", + "StructPtrHeadNumberString", + "StructPtrHeadOmitEmptyNumberString", "StructHeadIntPtr", "StructHeadOmitEmptyIntPtr", - "StructHeadStringTagIntPtr", "StructPtrHeadIntPtr", "StructPtrHeadOmitEmptyIntPtr", - "StructPtrHeadStringTagIntPtr", "StructHeadUintPtr", "StructHeadOmitEmptyUintPtr", - "StructHeadStringTagUintPtr", "StructPtrHeadUintPtr", "StructPtrHeadOmitEmptyUintPtr", - "StructPtrHeadStringTagUintPtr", "StructHeadFloat32Ptr", "StructHeadOmitEmptyFloat32Ptr", - "StructHeadStringTagFloat32Ptr", "StructPtrHeadFloat32Ptr", "StructPtrHeadOmitEmptyFloat32Ptr", - "StructPtrHeadStringTagFloat32Ptr", "StructHeadFloat64Ptr", "StructHeadOmitEmptyFloat64Ptr", - "StructHeadStringTagFloat64Ptr", "StructPtrHeadFloat64Ptr", "StructPtrHeadOmitEmptyFloat64Ptr", - "StructPtrHeadStringTagFloat64Ptr", "StructHeadBoolPtr", "StructHeadOmitEmptyBoolPtr", - "StructHeadStringTagBoolPtr", "StructPtrHeadBoolPtr", "StructPtrHeadOmitEmptyBoolPtr", - "StructPtrHeadStringTagBoolPtr", "StructHeadStringPtr", "StructHeadOmitEmptyStringPtr", - "StructHeadStringTagStringPtr", "StructPtrHeadStringPtr", "StructPtrHeadOmitEmptyStringPtr", - "StructPtrHeadStringTagStringPtr", "StructHeadBytesPtr", "StructHeadOmitEmptyBytesPtr", - "StructHeadStringTagBytesPtr", "StructPtrHeadBytesPtr", "StructPtrHeadOmitEmptyBytesPtr", - "StructPtrHeadStringTagBytesPtr", "StructHeadNumberPtr", "StructHeadOmitEmptyNumberPtr", - "StructHeadStringTagNumberPtr", "StructPtrHeadNumberPtr", "StructPtrHeadOmitEmptyNumberPtr", - "StructPtrHeadStringTagNumberPtr", "StructHeadArrayPtr", "StructHeadOmitEmptyArrayPtr", - "StructHeadStringTagArrayPtr", "StructPtrHeadArrayPtr", "StructPtrHeadOmitEmptyArrayPtr", - "StructPtrHeadStringTagArrayPtr", "StructHeadMapPtr", "StructHeadOmitEmptyMapPtr", - "StructHeadStringTagMapPtr", "StructPtrHeadMapPtr", "StructPtrHeadOmitEmptyMapPtr", - "StructPtrHeadStringTagMapPtr", "StructHeadSlicePtr", "StructHeadOmitEmptySlicePtr", - "StructHeadStringTagSlicePtr", "StructPtrHeadSlicePtr", "StructPtrHeadOmitEmptySlicePtr", - "StructPtrHeadStringTagSlicePtr", "StructHeadMarshalJSONPtr", "StructHeadOmitEmptyMarshalJSONPtr", - "StructHeadStringTagMarshalJSONPtr", "StructPtrHeadMarshalJSONPtr", "StructPtrHeadOmitEmptyMarshalJSONPtr", - "StructPtrHeadStringTagMarshalJSONPtr", "StructHeadMarshalTextPtr", "StructHeadOmitEmptyMarshalTextPtr", - "StructHeadStringTagMarshalTextPtr", "StructPtrHeadMarshalTextPtr", "StructPtrHeadOmitEmptyMarshalTextPtr", - "StructPtrHeadStringTagMarshalTextPtr", "StructHeadInterfacePtr", "StructHeadOmitEmptyInterfacePtr", - "StructHeadStringTagInterfacePtr", "StructPtrHeadInterfacePtr", "StructPtrHeadOmitEmptyInterfacePtr", - "StructPtrHeadStringTagInterfacePtr", + "StructHeadIntPtrString", + "StructHeadOmitEmptyIntPtrString", + "StructPtrHeadIntPtrString", + "StructPtrHeadOmitEmptyIntPtrString", + "StructHeadUintPtrString", + "StructHeadOmitEmptyUintPtrString", + "StructPtrHeadUintPtrString", + "StructPtrHeadOmitEmptyUintPtrString", + "StructHeadFloat32PtrString", + "StructHeadOmitEmptyFloat32PtrString", + "StructPtrHeadFloat32PtrString", + "StructPtrHeadOmitEmptyFloat32PtrString", + "StructHeadFloat64PtrString", + "StructHeadOmitEmptyFloat64PtrString", + "StructPtrHeadFloat64PtrString", + "StructPtrHeadOmitEmptyFloat64PtrString", + "StructHeadBoolPtrString", + "StructHeadOmitEmptyBoolPtrString", + "StructPtrHeadBoolPtrString", + "StructPtrHeadOmitEmptyBoolPtrString", + "StructHeadStringPtrString", + "StructHeadOmitEmptyStringPtrString", + "StructPtrHeadStringPtrString", + "StructPtrHeadOmitEmptyStringPtrString", + "StructHeadNumberPtrString", + "StructHeadOmitEmptyNumberPtrString", + "StructPtrHeadNumberPtrString", + "StructPtrHeadOmitEmptyNumberPtrString", "StructHead", "StructHeadOmitEmpty", - "StructHeadStringTag", "StructPtrHead", "StructPtrHeadOmitEmpty", - "StructPtrHeadStringTag", "StructFieldInt", "StructFieldOmitEmptyInt", - "StructFieldStringTagInt", "StructEndInt", "StructEndOmitEmptyInt", - "StructEndStringTagInt", "StructFieldUint", "StructFieldOmitEmptyUint", - "StructFieldStringTagUint", "StructEndUint", "StructEndOmitEmptyUint", - "StructEndStringTagUint", "StructFieldFloat32", "StructFieldOmitEmptyFloat32", - "StructFieldStringTagFloat32", "StructEndFloat32", "StructEndOmitEmptyFloat32", - "StructEndStringTagFloat32", "StructFieldFloat64", "StructFieldOmitEmptyFloat64", - "StructFieldStringTagFloat64", "StructEndFloat64", "StructEndOmitEmptyFloat64", - "StructEndStringTagFloat64", "StructFieldBool", "StructFieldOmitEmptyBool", - "StructFieldStringTagBool", "StructEndBool", "StructEndOmitEmptyBool", - "StructEndStringTagBool", "StructFieldString", "StructFieldOmitEmptyString", - "StructFieldStringTagString", "StructEndString", "StructEndOmitEmptyString", - "StructEndStringTagString", "StructFieldBytes", "StructFieldOmitEmptyBytes", - "StructFieldStringTagBytes", "StructEndBytes", "StructEndOmitEmptyBytes", - "StructEndStringTagBytes", "StructFieldNumber", "StructFieldOmitEmptyNumber", - "StructFieldStringTagNumber", "StructEndNumber", "StructEndOmitEmptyNumber", - "StructEndStringTagNumber", "StructFieldArray", "StructFieldOmitEmptyArray", - "StructFieldStringTagArray", "StructEndArray", "StructEndOmitEmptyArray", - "StructEndStringTagArray", "StructFieldMap", "StructFieldOmitEmptyMap", - "StructFieldStringTagMap", "StructEndMap", "StructEndOmitEmptyMap", - "StructEndStringTagMap", "StructFieldSlice", "StructFieldOmitEmptySlice", - "StructFieldStringTagSlice", "StructEndSlice", "StructEndOmitEmptySlice", - "StructEndStringTagSlice", "StructFieldStruct", "StructFieldOmitEmptyStruct", - "StructFieldStringTagStruct", "StructEndStruct", "StructEndOmitEmptyStruct", - "StructEndStringTagStruct", "StructFieldMarshalJSON", "StructFieldOmitEmptyMarshalJSON", - "StructFieldStringTagMarshalJSON", "StructEndMarshalJSON", "StructEndOmitEmptyMarshalJSON", - "StructEndStringTagMarshalJSON", "StructFieldMarshalText", "StructFieldOmitEmptyMarshalText", - "StructFieldStringTagMarshalText", "StructEndMarshalText", "StructEndOmitEmptyMarshalText", - "StructEndStringTagMarshalText", "StructFieldIntString", "StructFieldOmitEmptyIntString", - "StructFieldStringTagIntString", "StructEndIntString", "StructEndOmitEmptyIntString", - "StructEndStringTagIntString", "StructFieldUintString", "StructFieldOmitEmptyUintString", - "StructFieldStringTagUintString", "StructEndUintString", "StructEndOmitEmptyUintString", - "StructEndStringTagUintString", + "StructFieldFloat32String", + "StructFieldOmitEmptyFloat32String", + "StructEndFloat32String", + "StructEndOmitEmptyFloat32String", + "StructFieldFloat64String", + "StructFieldOmitEmptyFloat64String", + "StructEndFloat64String", + "StructEndOmitEmptyFloat64String", + "StructFieldBoolString", + "StructFieldOmitEmptyBoolString", + "StructEndBoolString", + "StructEndOmitEmptyBoolString", + "StructFieldStringString", + "StructFieldOmitEmptyStringString", + "StructEndStringString", + "StructEndOmitEmptyStringString", + "StructFieldNumberString", + "StructFieldOmitEmptyNumberString", + "StructEndNumberString", + "StructEndOmitEmptyNumberString", "StructFieldIntPtr", "StructFieldOmitEmptyIntPtr", - "StructFieldStringTagIntPtr", "StructEndIntPtr", "StructEndOmitEmptyIntPtr", - "StructEndStringTagIntPtr", "StructFieldUintPtr", "StructFieldOmitEmptyUintPtr", - "StructFieldStringTagUintPtr", "StructEndUintPtr", "StructEndOmitEmptyUintPtr", - "StructEndStringTagUintPtr", "StructFieldFloat32Ptr", "StructFieldOmitEmptyFloat32Ptr", - "StructFieldStringTagFloat32Ptr", "StructEndFloat32Ptr", "StructEndOmitEmptyFloat32Ptr", - "StructEndStringTagFloat32Ptr", "StructFieldFloat64Ptr", "StructFieldOmitEmptyFloat64Ptr", - "StructFieldStringTagFloat64Ptr", "StructEndFloat64Ptr", "StructEndOmitEmptyFloat64Ptr", - "StructEndStringTagFloat64Ptr", "StructFieldBoolPtr", "StructFieldOmitEmptyBoolPtr", - "StructFieldStringTagBoolPtr", "StructEndBoolPtr", "StructEndOmitEmptyBoolPtr", - "StructEndStringTagBoolPtr", "StructFieldStringPtr", "StructFieldOmitEmptyStringPtr", - "StructFieldStringTagStringPtr", "StructEndStringPtr", "StructEndOmitEmptyStringPtr", - "StructEndStringTagStringPtr", "StructFieldBytesPtr", "StructFieldOmitEmptyBytesPtr", - "StructFieldStringTagBytesPtr", "StructEndBytesPtr", "StructEndOmitEmptyBytesPtr", - "StructEndStringTagBytesPtr", "StructFieldNumberPtr", "StructFieldOmitEmptyNumberPtr", - "StructFieldStringTagNumberPtr", "StructEndNumberPtr", "StructEndOmitEmptyNumberPtr", - "StructEndStringTagNumberPtr", "StructFieldArrayPtr", "StructFieldOmitEmptyArrayPtr", - "StructFieldStringTagArrayPtr", "StructEndArrayPtr", "StructEndOmitEmptyArrayPtr", - "StructEndStringTagArrayPtr", "StructFieldMapPtr", "StructFieldOmitEmptyMapPtr", - "StructFieldStringTagMapPtr", "StructEndMapPtr", "StructEndOmitEmptyMapPtr", - "StructEndStringTagMapPtr", "StructFieldSlicePtr", "StructFieldOmitEmptySlicePtr", - "StructFieldStringTagSlicePtr", "StructEndSlicePtr", "StructEndOmitEmptySlicePtr", - "StructEndStringTagSlicePtr", "StructFieldMarshalJSONPtr", "StructFieldOmitEmptyMarshalJSONPtr", - "StructFieldStringTagMarshalJSONPtr", "StructEndMarshalJSONPtr", "StructEndOmitEmptyMarshalJSONPtr", - "StructEndStringTagMarshalJSONPtr", "StructFieldMarshalTextPtr", "StructFieldOmitEmptyMarshalTextPtr", - "StructFieldStringTagMarshalTextPtr", "StructEndMarshalTextPtr", "StructEndOmitEmptyMarshalTextPtr", - "StructEndStringTagMarshalTextPtr", "StructFieldInterfacePtr", "StructFieldOmitEmptyInterfacePtr", - "StructFieldStringTagInterfacePtr", "StructEndInterfacePtr", "StructEndOmitEmptyInterfacePtr", - "StructEndStringTagInterfacePtr", + "StructFieldIntPtrString", + "StructFieldOmitEmptyIntPtrString", + "StructEndIntPtrString", + "StructEndOmitEmptyIntPtrString", + "StructFieldUintPtrString", + "StructFieldOmitEmptyUintPtrString", + "StructEndUintPtrString", + "StructEndOmitEmptyUintPtrString", + "StructFieldFloat32PtrString", + "StructFieldOmitEmptyFloat32PtrString", + "StructEndFloat32PtrString", + "StructEndOmitEmptyFloat32PtrString", + "StructFieldFloat64PtrString", + "StructFieldOmitEmptyFloat64PtrString", + "StructEndFloat64PtrString", + "StructEndOmitEmptyFloat64PtrString", + "StructFieldBoolPtrString", + "StructFieldOmitEmptyBoolPtrString", + "StructEndBoolPtrString", + "StructEndOmitEmptyBoolPtrString", + "StructFieldStringPtrString", + "StructFieldOmitEmptyStringPtrString", + "StructEndStringPtrString", + "StructEndOmitEmptyStringPtrString", + "StructFieldNumberPtrString", + "StructFieldOmitEmptyNumberPtrString", + "StructEndNumberPtrString", + "StructEndOmitEmptyNumberPtrString", "StructField", "StructFieldOmitEmpty", - "StructFieldStringTag", "StructEnd", "StructEndOmitEmpty", - "StructEndStringTag", } type OpType int const ( - OpEnd OpType = 0 - OpInterface OpType = 1 - OpPtr OpType = 2 - OpSliceElem OpType = 3 - OpSliceEnd OpType = 4 - OpArrayElem OpType = 5 - OpArrayEnd OpType = 6 - OpMapKey OpType = 7 - OpMapValue OpType = 8 - OpMapEnd OpType = 9 - OpRecursive OpType = 10 - OpRecursivePtr OpType = 11 - OpRecursiveEnd OpType = 12 - OpStructAnonymousEnd OpType = 13 - OpInt OpType = 14 - OpUint OpType = 15 - OpFloat32 OpType = 16 - OpFloat64 OpType = 17 - OpBool OpType = 18 - OpString OpType = 19 - OpBytes OpType = 20 - OpNumber OpType = 21 - OpArray OpType = 22 - OpMap OpType = 23 - OpSlice OpType = 24 - OpStruct OpType = 25 - OpMarshalJSON OpType = 26 - OpMarshalText OpType = 27 - OpIntString OpType = 28 - OpUintString OpType = 29 - OpIntPtr OpType = 30 - OpUintPtr OpType = 31 - OpFloat32Ptr OpType = 32 - OpFloat64Ptr OpType = 33 - OpBoolPtr OpType = 34 - OpStringPtr OpType = 35 - OpBytesPtr OpType = 36 - OpNumberPtr OpType = 37 - OpArrayPtr OpType = 38 - OpMapPtr OpType = 39 - OpSlicePtr OpType = 40 - OpMarshalJSONPtr OpType = 41 - OpMarshalTextPtr OpType = 42 - OpInterfacePtr OpType = 43 - OpStructHeadInt OpType = 44 - OpStructHeadOmitEmptyInt OpType = 45 - OpStructHeadStringTagInt OpType = 46 - OpStructPtrHeadInt OpType = 47 - OpStructPtrHeadOmitEmptyInt OpType = 48 - OpStructPtrHeadStringTagInt OpType = 49 - OpStructHeadUint OpType = 50 - OpStructHeadOmitEmptyUint OpType = 51 - OpStructHeadStringTagUint OpType = 52 - OpStructPtrHeadUint OpType = 53 - OpStructPtrHeadOmitEmptyUint OpType = 54 - OpStructPtrHeadStringTagUint OpType = 55 - OpStructHeadFloat32 OpType = 56 - OpStructHeadOmitEmptyFloat32 OpType = 57 - OpStructHeadStringTagFloat32 OpType = 58 - OpStructPtrHeadFloat32 OpType = 59 - OpStructPtrHeadOmitEmptyFloat32 OpType = 60 - OpStructPtrHeadStringTagFloat32 OpType = 61 - OpStructHeadFloat64 OpType = 62 - OpStructHeadOmitEmptyFloat64 OpType = 63 - OpStructHeadStringTagFloat64 OpType = 64 - OpStructPtrHeadFloat64 OpType = 65 - OpStructPtrHeadOmitEmptyFloat64 OpType = 66 - OpStructPtrHeadStringTagFloat64 OpType = 67 - OpStructHeadBool OpType = 68 - OpStructHeadOmitEmptyBool OpType = 69 - OpStructHeadStringTagBool OpType = 70 - OpStructPtrHeadBool OpType = 71 - OpStructPtrHeadOmitEmptyBool OpType = 72 - OpStructPtrHeadStringTagBool OpType = 73 - OpStructHeadString OpType = 74 - OpStructHeadOmitEmptyString OpType = 75 - OpStructHeadStringTagString OpType = 76 - OpStructPtrHeadString OpType = 77 - OpStructPtrHeadOmitEmptyString OpType = 78 - OpStructPtrHeadStringTagString OpType = 79 - OpStructHeadBytes OpType = 80 - OpStructHeadOmitEmptyBytes OpType = 81 - OpStructHeadStringTagBytes OpType = 82 - OpStructPtrHeadBytes OpType = 83 - OpStructPtrHeadOmitEmptyBytes OpType = 84 - OpStructPtrHeadStringTagBytes OpType = 85 - OpStructHeadNumber OpType = 86 - OpStructHeadOmitEmptyNumber OpType = 87 - OpStructHeadStringTagNumber OpType = 88 - OpStructPtrHeadNumber OpType = 89 - OpStructPtrHeadOmitEmptyNumber OpType = 90 - OpStructPtrHeadStringTagNumber OpType = 91 - OpStructHeadArray OpType = 92 - OpStructHeadOmitEmptyArray OpType = 93 - OpStructHeadStringTagArray OpType = 94 - OpStructPtrHeadArray OpType = 95 - OpStructPtrHeadOmitEmptyArray OpType = 96 - OpStructPtrHeadStringTagArray OpType = 97 - OpStructHeadMap OpType = 98 - OpStructHeadOmitEmptyMap OpType = 99 - OpStructHeadStringTagMap OpType = 100 - OpStructPtrHeadMap OpType = 101 - OpStructPtrHeadOmitEmptyMap OpType = 102 - OpStructPtrHeadStringTagMap OpType = 103 - OpStructHeadSlice OpType = 104 - OpStructHeadOmitEmptySlice OpType = 105 - OpStructHeadStringTagSlice OpType = 106 - OpStructPtrHeadSlice OpType = 107 - OpStructPtrHeadOmitEmptySlice OpType = 108 - OpStructPtrHeadStringTagSlice OpType = 109 - OpStructHeadStruct OpType = 110 - OpStructHeadOmitEmptyStruct OpType = 111 - OpStructHeadStringTagStruct OpType = 112 - OpStructPtrHeadStruct OpType = 113 - OpStructPtrHeadOmitEmptyStruct OpType = 114 - OpStructPtrHeadStringTagStruct OpType = 115 - OpStructHeadMarshalJSON OpType = 116 - OpStructHeadOmitEmptyMarshalJSON OpType = 117 - OpStructHeadStringTagMarshalJSON OpType = 118 - OpStructPtrHeadMarshalJSON OpType = 119 - OpStructPtrHeadOmitEmptyMarshalJSON OpType = 120 - OpStructPtrHeadStringTagMarshalJSON OpType = 121 - OpStructHeadMarshalText OpType = 122 - OpStructHeadOmitEmptyMarshalText OpType = 123 - OpStructHeadStringTagMarshalText OpType = 124 - OpStructPtrHeadMarshalText OpType = 125 - OpStructPtrHeadOmitEmptyMarshalText OpType = 126 - OpStructPtrHeadStringTagMarshalText OpType = 127 - OpStructHeadIntString OpType = 128 - OpStructHeadOmitEmptyIntString OpType = 129 - OpStructHeadStringTagIntString OpType = 130 - OpStructPtrHeadIntString OpType = 131 - OpStructPtrHeadOmitEmptyIntString OpType = 132 - OpStructPtrHeadStringTagIntString OpType = 133 - OpStructHeadUintString OpType = 134 - OpStructHeadOmitEmptyUintString OpType = 135 - OpStructHeadStringTagUintString OpType = 136 - OpStructPtrHeadUintString OpType = 137 - OpStructPtrHeadOmitEmptyUintString OpType = 138 - OpStructPtrHeadStringTagUintString OpType = 139 - OpStructHeadIntPtr OpType = 140 - OpStructHeadOmitEmptyIntPtr OpType = 141 - OpStructHeadStringTagIntPtr OpType = 142 - OpStructPtrHeadIntPtr OpType = 143 - OpStructPtrHeadOmitEmptyIntPtr OpType = 144 - OpStructPtrHeadStringTagIntPtr OpType = 145 - OpStructHeadUintPtr OpType = 146 - OpStructHeadOmitEmptyUintPtr OpType = 147 - OpStructHeadStringTagUintPtr OpType = 148 - OpStructPtrHeadUintPtr OpType = 149 - OpStructPtrHeadOmitEmptyUintPtr OpType = 150 - OpStructPtrHeadStringTagUintPtr OpType = 151 - OpStructHeadFloat32Ptr OpType = 152 - OpStructHeadOmitEmptyFloat32Ptr OpType = 153 - OpStructHeadStringTagFloat32Ptr OpType = 154 - OpStructPtrHeadFloat32Ptr OpType = 155 - OpStructPtrHeadOmitEmptyFloat32Ptr OpType = 156 - OpStructPtrHeadStringTagFloat32Ptr OpType = 157 - OpStructHeadFloat64Ptr OpType = 158 - OpStructHeadOmitEmptyFloat64Ptr OpType = 159 - OpStructHeadStringTagFloat64Ptr OpType = 160 - OpStructPtrHeadFloat64Ptr OpType = 161 - OpStructPtrHeadOmitEmptyFloat64Ptr OpType = 162 - OpStructPtrHeadStringTagFloat64Ptr OpType = 163 - OpStructHeadBoolPtr OpType = 164 - OpStructHeadOmitEmptyBoolPtr OpType = 165 - OpStructHeadStringTagBoolPtr OpType = 166 - OpStructPtrHeadBoolPtr OpType = 167 - OpStructPtrHeadOmitEmptyBoolPtr OpType = 168 - OpStructPtrHeadStringTagBoolPtr OpType = 169 - OpStructHeadStringPtr OpType = 170 - OpStructHeadOmitEmptyStringPtr OpType = 171 - OpStructHeadStringTagStringPtr OpType = 172 - OpStructPtrHeadStringPtr OpType = 173 - OpStructPtrHeadOmitEmptyStringPtr OpType = 174 - OpStructPtrHeadStringTagStringPtr OpType = 175 - OpStructHeadBytesPtr OpType = 176 - OpStructHeadOmitEmptyBytesPtr OpType = 177 - OpStructHeadStringTagBytesPtr OpType = 178 - OpStructPtrHeadBytesPtr OpType = 179 - OpStructPtrHeadOmitEmptyBytesPtr OpType = 180 - OpStructPtrHeadStringTagBytesPtr OpType = 181 - OpStructHeadNumberPtr OpType = 182 - OpStructHeadOmitEmptyNumberPtr OpType = 183 - OpStructHeadStringTagNumberPtr OpType = 184 - OpStructPtrHeadNumberPtr OpType = 185 - OpStructPtrHeadOmitEmptyNumberPtr OpType = 186 - OpStructPtrHeadStringTagNumberPtr OpType = 187 - OpStructHeadArrayPtr OpType = 188 - OpStructHeadOmitEmptyArrayPtr OpType = 189 - OpStructHeadStringTagArrayPtr OpType = 190 - OpStructPtrHeadArrayPtr OpType = 191 - OpStructPtrHeadOmitEmptyArrayPtr OpType = 192 - OpStructPtrHeadStringTagArrayPtr OpType = 193 - OpStructHeadMapPtr OpType = 194 - OpStructHeadOmitEmptyMapPtr OpType = 195 - OpStructHeadStringTagMapPtr OpType = 196 - OpStructPtrHeadMapPtr OpType = 197 - OpStructPtrHeadOmitEmptyMapPtr OpType = 198 - OpStructPtrHeadStringTagMapPtr OpType = 199 - OpStructHeadSlicePtr OpType = 200 - OpStructHeadOmitEmptySlicePtr OpType = 201 - OpStructHeadStringTagSlicePtr OpType = 202 - OpStructPtrHeadSlicePtr OpType = 203 - OpStructPtrHeadOmitEmptySlicePtr OpType = 204 - OpStructPtrHeadStringTagSlicePtr OpType = 205 - OpStructHeadMarshalJSONPtr OpType = 206 - OpStructHeadOmitEmptyMarshalJSONPtr OpType = 207 - OpStructHeadStringTagMarshalJSONPtr OpType = 208 - OpStructPtrHeadMarshalJSONPtr OpType = 209 - OpStructPtrHeadOmitEmptyMarshalJSONPtr OpType = 210 - OpStructPtrHeadStringTagMarshalJSONPtr OpType = 211 - OpStructHeadMarshalTextPtr OpType = 212 - OpStructHeadOmitEmptyMarshalTextPtr OpType = 213 - OpStructHeadStringTagMarshalTextPtr OpType = 214 - OpStructPtrHeadMarshalTextPtr OpType = 215 - OpStructPtrHeadOmitEmptyMarshalTextPtr OpType = 216 - OpStructPtrHeadStringTagMarshalTextPtr OpType = 217 - OpStructHeadInterfacePtr OpType = 218 - OpStructHeadOmitEmptyInterfacePtr OpType = 219 - OpStructHeadStringTagInterfacePtr OpType = 220 - OpStructPtrHeadInterfacePtr OpType = 221 - OpStructPtrHeadOmitEmptyInterfacePtr OpType = 222 - OpStructPtrHeadStringTagInterfacePtr OpType = 223 - OpStructHead OpType = 224 - OpStructHeadOmitEmpty OpType = 225 - OpStructHeadStringTag OpType = 226 - OpStructPtrHead OpType = 227 - OpStructPtrHeadOmitEmpty OpType = 228 - OpStructPtrHeadStringTag OpType = 229 - OpStructFieldInt OpType = 230 - OpStructFieldOmitEmptyInt OpType = 231 - OpStructFieldStringTagInt OpType = 232 - OpStructEndInt OpType = 233 - OpStructEndOmitEmptyInt OpType = 234 - OpStructEndStringTagInt OpType = 235 - OpStructFieldUint OpType = 236 - OpStructFieldOmitEmptyUint OpType = 237 - OpStructFieldStringTagUint OpType = 238 - OpStructEndUint OpType = 239 - OpStructEndOmitEmptyUint OpType = 240 - OpStructEndStringTagUint OpType = 241 - OpStructFieldFloat32 OpType = 242 - OpStructFieldOmitEmptyFloat32 OpType = 243 - OpStructFieldStringTagFloat32 OpType = 244 - OpStructEndFloat32 OpType = 245 - OpStructEndOmitEmptyFloat32 OpType = 246 - OpStructEndStringTagFloat32 OpType = 247 - OpStructFieldFloat64 OpType = 248 - OpStructFieldOmitEmptyFloat64 OpType = 249 - OpStructFieldStringTagFloat64 OpType = 250 - OpStructEndFloat64 OpType = 251 - OpStructEndOmitEmptyFloat64 OpType = 252 - OpStructEndStringTagFloat64 OpType = 253 - OpStructFieldBool OpType = 254 - OpStructFieldOmitEmptyBool OpType = 255 - OpStructFieldStringTagBool OpType = 256 - OpStructEndBool OpType = 257 - OpStructEndOmitEmptyBool OpType = 258 - OpStructEndStringTagBool OpType = 259 - OpStructFieldString OpType = 260 - OpStructFieldOmitEmptyString OpType = 261 - OpStructFieldStringTagString OpType = 262 - OpStructEndString OpType = 263 - OpStructEndOmitEmptyString OpType = 264 - OpStructEndStringTagString OpType = 265 - OpStructFieldBytes OpType = 266 - OpStructFieldOmitEmptyBytes OpType = 267 - OpStructFieldStringTagBytes OpType = 268 - OpStructEndBytes OpType = 269 - OpStructEndOmitEmptyBytes OpType = 270 - OpStructEndStringTagBytes OpType = 271 - OpStructFieldNumber OpType = 272 - OpStructFieldOmitEmptyNumber OpType = 273 - OpStructFieldStringTagNumber OpType = 274 - OpStructEndNumber OpType = 275 - OpStructEndOmitEmptyNumber OpType = 276 - OpStructEndStringTagNumber OpType = 277 - OpStructFieldArray OpType = 278 - OpStructFieldOmitEmptyArray OpType = 279 - OpStructFieldStringTagArray OpType = 280 - OpStructEndArray OpType = 281 - OpStructEndOmitEmptyArray OpType = 282 - OpStructEndStringTagArray OpType = 283 - OpStructFieldMap OpType = 284 - OpStructFieldOmitEmptyMap OpType = 285 - OpStructFieldStringTagMap OpType = 286 - OpStructEndMap OpType = 287 - OpStructEndOmitEmptyMap OpType = 288 - OpStructEndStringTagMap OpType = 289 - OpStructFieldSlice OpType = 290 - OpStructFieldOmitEmptySlice OpType = 291 - OpStructFieldStringTagSlice OpType = 292 - OpStructEndSlice OpType = 293 - OpStructEndOmitEmptySlice OpType = 294 - OpStructEndStringTagSlice OpType = 295 - OpStructFieldStruct OpType = 296 - OpStructFieldOmitEmptyStruct OpType = 297 - OpStructFieldStringTagStruct OpType = 298 - OpStructEndStruct OpType = 299 - OpStructEndOmitEmptyStruct OpType = 300 - OpStructEndStringTagStruct OpType = 301 - OpStructFieldMarshalJSON OpType = 302 - OpStructFieldOmitEmptyMarshalJSON OpType = 303 - OpStructFieldStringTagMarshalJSON OpType = 304 - OpStructEndMarshalJSON OpType = 305 - OpStructEndOmitEmptyMarshalJSON OpType = 306 - OpStructEndStringTagMarshalJSON OpType = 307 - OpStructFieldMarshalText OpType = 308 - OpStructFieldOmitEmptyMarshalText OpType = 309 - OpStructFieldStringTagMarshalText OpType = 310 - OpStructEndMarshalText OpType = 311 - OpStructEndOmitEmptyMarshalText OpType = 312 - OpStructEndStringTagMarshalText OpType = 313 - OpStructFieldIntString OpType = 314 - OpStructFieldOmitEmptyIntString OpType = 315 - OpStructFieldStringTagIntString OpType = 316 - OpStructEndIntString OpType = 317 - OpStructEndOmitEmptyIntString OpType = 318 - OpStructEndStringTagIntString OpType = 319 - OpStructFieldUintString OpType = 320 - OpStructFieldOmitEmptyUintString OpType = 321 - OpStructFieldStringTagUintString OpType = 322 - OpStructEndUintString OpType = 323 - OpStructEndOmitEmptyUintString OpType = 324 - OpStructEndStringTagUintString OpType = 325 - OpStructFieldIntPtr OpType = 326 - OpStructFieldOmitEmptyIntPtr OpType = 327 - OpStructFieldStringTagIntPtr OpType = 328 - OpStructEndIntPtr OpType = 329 - OpStructEndOmitEmptyIntPtr OpType = 330 - OpStructEndStringTagIntPtr OpType = 331 - OpStructFieldUintPtr OpType = 332 - OpStructFieldOmitEmptyUintPtr OpType = 333 - OpStructFieldStringTagUintPtr OpType = 334 - OpStructEndUintPtr OpType = 335 - OpStructEndOmitEmptyUintPtr OpType = 336 - OpStructEndStringTagUintPtr OpType = 337 - OpStructFieldFloat32Ptr OpType = 338 - OpStructFieldOmitEmptyFloat32Ptr OpType = 339 - OpStructFieldStringTagFloat32Ptr OpType = 340 - OpStructEndFloat32Ptr OpType = 341 - OpStructEndOmitEmptyFloat32Ptr OpType = 342 - OpStructEndStringTagFloat32Ptr OpType = 343 - OpStructFieldFloat64Ptr OpType = 344 - OpStructFieldOmitEmptyFloat64Ptr OpType = 345 - OpStructFieldStringTagFloat64Ptr OpType = 346 - OpStructEndFloat64Ptr OpType = 347 - OpStructEndOmitEmptyFloat64Ptr OpType = 348 - OpStructEndStringTagFloat64Ptr OpType = 349 - OpStructFieldBoolPtr OpType = 350 - OpStructFieldOmitEmptyBoolPtr OpType = 351 - OpStructFieldStringTagBoolPtr OpType = 352 - OpStructEndBoolPtr OpType = 353 - OpStructEndOmitEmptyBoolPtr OpType = 354 - OpStructEndStringTagBoolPtr OpType = 355 - OpStructFieldStringPtr OpType = 356 - OpStructFieldOmitEmptyStringPtr OpType = 357 - OpStructFieldStringTagStringPtr OpType = 358 - OpStructEndStringPtr OpType = 359 - OpStructEndOmitEmptyStringPtr OpType = 360 - OpStructEndStringTagStringPtr OpType = 361 - OpStructFieldBytesPtr OpType = 362 - OpStructFieldOmitEmptyBytesPtr OpType = 363 - OpStructFieldStringTagBytesPtr OpType = 364 - OpStructEndBytesPtr OpType = 365 - OpStructEndOmitEmptyBytesPtr OpType = 366 - OpStructEndStringTagBytesPtr OpType = 367 - OpStructFieldNumberPtr OpType = 368 - OpStructFieldOmitEmptyNumberPtr OpType = 369 - OpStructFieldStringTagNumberPtr OpType = 370 - OpStructEndNumberPtr OpType = 371 - OpStructEndOmitEmptyNumberPtr OpType = 372 - OpStructEndStringTagNumberPtr OpType = 373 - OpStructFieldArrayPtr OpType = 374 - OpStructFieldOmitEmptyArrayPtr OpType = 375 - OpStructFieldStringTagArrayPtr OpType = 376 - OpStructEndArrayPtr OpType = 377 - OpStructEndOmitEmptyArrayPtr OpType = 378 - OpStructEndStringTagArrayPtr OpType = 379 - OpStructFieldMapPtr OpType = 380 - OpStructFieldOmitEmptyMapPtr OpType = 381 - OpStructFieldStringTagMapPtr OpType = 382 - OpStructEndMapPtr OpType = 383 - OpStructEndOmitEmptyMapPtr OpType = 384 - OpStructEndStringTagMapPtr OpType = 385 - OpStructFieldSlicePtr OpType = 386 - OpStructFieldOmitEmptySlicePtr OpType = 387 - OpStructFieldStringTagSlicePtr OpType = 388 - OpStructEndSlicePtr OpType = 389 - OpStructEndOmitEmptySlicePtr OpType = 390 - OpStructEndStringTagSlicePtr OpType = 391 - OpStructFieldMarshalJSONPtr OpType = 392 - OpStructFieldOmitEmptyMarshalJSONPtr OpType = 393 - OpStructFieldStringTagMarshalJSONPtr OpType = 394 - OpStructEndMarshalJSONPtr OpType = 395 - OpStructEndOmitEmptyMarshalJSONPtr OpType = 396 - OpStructEndStringTagMarshalJSONPtr OpType = 397 - OpStructFieldMarshalTextPtr OpType = 398 - OpStructFieldOmitEmptyMarshalTextPtr OpType = 399 - OpStructFieldStringTagMarshalTextPtr OpType = 400 - OpStructEndMarshalTextPtr OpType = 401 - OpStructEndOmitEmptyMarshalTextPtr OpType = 402 - OpStructEndStringTagMarshalTextPtr OpType = 403 - OpStructFieldInterfacePtr OpType = 404 - OpStructFieldOmitEmptyInterfacePtr OpType = 405 - OpStructFieldStringTagInterfacePtr OpType = 406 - OpStructEndInterfacePtr OpType = 407 - OpStructEndOmitEmptyInterfacePtr OpType = 408 - OpStructEndStringTagInterfacePtr OpType = 409 - OpStructField OpType = 410 - OpStructFieldOmitEmpty OpType = 411 - OpStructFieldStringTag OpType = 412 - OpStructEnd OpType = 413 - OpStructEndOmitEmpty OpType = 414 - OpStructEndStringTag OpType = 415 + OpEnd OpType = 0 + OpInterface OpType = 1 + OpPtr OpType = 2 + OpSliceElem OpType = 3 + OpSliceEnd OpType = 4 + OpArrayElem OpType = 5 + OpArrayEnd OpType = 6 + OpMapKey OpType = 7 + OpMapValue OpType = 8 + OpMapEnd OpType = 9 + OpRecursive OpType = 10 + OpRecursivePtr OpType = 11 + OpRecursiveEnd OpType = 12 + OpStructAnonymousEnd OpType = 13 + OpInt OpType = 14 + OpUint OpType = 15 + OpFloat32 OpType = 16 + OpFloat64 OpType = 17 + OpBool OpType = 18 + OpString OpType = 19 + OpBytes OpType = 20 + OpNumber OpType = 21 + OpArray OpType = 22 + OpMap OpType = 23 + OpSlice OpType = 24 + OpStruct OpType = 25 + OpMarshalJSON OpType = 26 + OpMarshalText OpType = 27 + OpIntString OpType = 28 + OpUintString OpType = 29 + OpFloat32String OpType = 30 + OpFloat64String OpType = 31 + OpBoolString OpType = 32 + OpStringString OpType = 33 + OpNumberString OpType = 34 + OpIntPtr OpType = 35 + OpUintPtr OpType = 36 + OpFloat32Ptr OpType = 37 + OpFloat64Ptr OpType = 38 + OpBoolPtr OpType = 39 + OpStringPtr OpType = 40 + OpBytesPtr OpType = 41 + OpNumberPtr OpType = 42 + OpArrayPtr OpType = 43 + OpMapPtr OpType = 44 + OpSlicePtr OpType = 45 + OpMarshalJSONPtr OpType = 46 + OpMarshalTextPtr OpType = 47 + OpInterfacePtr OpType = 48 + OpIntPtrString OpType = 49 + OpUintPtrString OpType = 50 + OpFloat32PtrString OpType = 51 + OpFloat64PtrString OpType = 52 + OpBoolPtrString OpType = 53 + OpStringPtrString OpType = 54 + OpNumberPtrString OpType = 55 + OpStructHeadInt OpType = 56 + OpStructHeadOmitEmptyInt OpType = 57 + OpStructPtrHeadInt OpType = 58 + OpStructPtrHeadOmitEmptyInt OpType = 59 + OpStructHeadUint OpType = 60 + OpStructHeadOmitEmptyUint OpType = 61 + OpStructPtrHeadUint OpType = 62 + OpStructPtrHeadOmitEmptyUint OpType = 63 + OpStructHeadFloat32 OpType = 64 + OpStructHeadOmitEmptyFloat32 OpType = 65 + OpStructPtrHeadFloat32 OpType = 66 + OpStructPtrHeadOmitEmptyFloat32 OpType = 67 + OpStructHeadFloat64 OpType = 68 + OpStructHeadOmitEmptyFloat64 OpType = 69 + OpStructPtrHeadFloat64 OpType = 70 + OpStructPtrHeadOmitEmptyFloat64 OpType = 71 + OpStructHeadBool OpType = 72 + OpStructHeadOmitEmptyBool OpType = 73 + OpStructPtrHeadBool OpType = 74 + OpStructPtrHeadOmitEmptyBool OpType = 75 + OpStructHeadString OpType = 76 + OpStructHeadOmitEmptyString OpType = 77 + OpStructPtrHeadString OpType = 78 + OpStructPtrHeadOmitEmptyString OpType = 79 + OpStructHeadBytes OpType = 80 + OpStructHeadOmitEmptyBytes OpType = 81 + OpStructPtrHeadBytes OpType = 82 + OpStructPtrHeadOmitEmptyBytes OpType = 83 + OpStructHeadNumber OpType = 84 + OpStructHeadOmitEmptyNumber OpType = 85 + OpStructPtrHeadNumber OpType = 86 + OpStructPtrHeadOmitEmptyNumber OpType = 87 + OpStructHeadArray OpType = 88 + OpStructHeadOmitEmptyArray OpType = 89 + OpStructPtrHeadArray OpType = 90 + OpStructPtrHeadOmitEmptyArray OpType = 91 + OpStructHeadMap OpType = 92 + OpStructHeadOmitEmptyMap OpType = 93 + OpStructPtrHeadMap OpType = 94 + OpStructPtrHeadOmitEmptyMap OpType = 95 + OpStructHeadSlice OpType = 96 + OpStructHeadOmitEmptySlice OpType = 97 + OpStructPtrHeadSlice OpType = 98 + OpStructPtrHeadOmitEmptySlice OpType = 99 + OpStructHeadStruct OpType = 100 + OpStructHeadOmitEmptyStruct OpType = 101 + OpStructPtrHeadStruct OpType = 102 + OpStructPtrHeadOmitEmptyStruct OpType = 103 + OpStructHeadMarshalJSON OpType = 104 + OpStructHeadOmitEmptyMarshalJSON OpType = 105 + OpStructPtrHeadMarshalJSON OpType = 106 + OpStructPtrHeadOmitEmptyMarshalJSON OpType = 107 + OpStructHeadMarshalText OpType = 108 + OpStructHeadOmitEmptyMarshalText OpType = 109 + OpStructPtrHeadMarshalText OpType = 110 + OpStructPtrHeadOmitEmptyMarshalText OpType = 111 + OpStructHeadIntString OpType = 112 + OpStructHeadOmitEmptyIntString OpType = 113 + OpStructPtrHeadIntString OpType = 114 + OpStructPtrHeadOmitEmptyIntString OpType = 115 + OpStructHeadUintString OpType = 116 + OpStructHeadOmitEmptyUintString OpType = 117 + OpStructPtrHeadUintString OpType = 118 + OpStructPtrHeadOmitEmptyUintString OpType = 119 + OpStructHeadFloat32String OpType = 120 + OpStructHeadOmitEmptyFloat32String OpType = 121 + OpStructPtrHeadFloat32String OpType = 122 + OpStructPtrHeadOmitEmptyFloat32String OpType = 123 + OpStructHeadFloat64String OpType = 124 + OpStructHeadOmitEmptyFloat64String OpType = 125 + OpStructPtrHeadFloat64String OpType = 126 + OpStructPtrHeadOmitEmptyFloat64String OpType = 127 + OpStructHeadBoolString OpType = 128 + OpStructHeadOmitEmptyBoolString OpType = 129 + OpStructPtrHeadBoolString OpType = 130 + OpStructPtrHeadOmitEmptyBoolString OpType = 131 + OpStructHeadStringString OpType = 132 + OpStructHeadOmitEmptyStringString OpType = 133 + OpStructPtrHeadStringString OpType = 134 + OpStructPtrHeadOmitEmptyStringString OpType = 135 + OpStructHeadNumberString OpType = 136 + OpStructHeadOmitEmptyNumberString OpType = 137 + OpStructPtrHeadNumberString OpType = 138 + OpStructPtrHeadOmitEmptyNumberString OpType = 139 + OpStructHeadIntPtr OpType = 140 + OpStructHeadOmitEmptyIntPtr OpType = 141 + OpStructPtrHeadIntPtr OpType = 142 + OpStructPtrHeadOmitEmptyIntPtr OpType = 143 + OpStructHeadUintPtr OpType = 144 + OpStructHeadOmitEmptyUintPtr OpType = 145 + OpStructPtrHeadUintPtr OpType = 146 + OpStructPtrHeadOmitEmptyUintPtr OpType = 147 + OpStructHeadFloat32Ptr OpType = 148 + OpStructHeadOmitEmptyFloat32Ptr OpType = 149 + OpStructPtrHeadFloat32Ptr OpType = 150 + OpStructPtrHeadOmitEmptyFloat32Ptr OpType = 151 + OpStructHeadFloat64Ptr OpType = 152 + OpStructHeadOmitEmptyFloat64Ptr OpType = 153 + OpStructPtrHeadFloat64Ptr OpType = 154 + OpStructPtrHeadOmitEmptyFloat64Ptr OpType = 155 + OpStructHeadBoolPtr OpType = 156 + OpStructHeadOmitEmptyBoolPtr OpType = 157 + OpStructPtrHeadBoolPtr OpType = 158 + OpStructPtrHeadOmitEmptyBoolPtr OpType = 159 + OpStructHeadStringPtr OpType = 160 + OpStructHeadOmitEmptyStringPtr OpType = 161 + OpStructPtrHeadStringPtr OpType = 162 + OpStructPtrHeadOmitEmptyStringPtr OpType = 163 + OpStructHeadBytesPtr OpType = 164 + OpStructHeadOmitEmptyBytesPtr OpType = 165 + OpStructPtrHeadBytesPtr OpType = 166 + OpStructPtrHeadOmitEmptyBytesPtr OpType = 167 + OpStructHeadNumberPtr OpType = 168 + OpStructHeadOmitEmptyNumberPtr OpType = 169 + OpStructPtrHeadNumberPtr OpType = 170 + OpStructPtrHeadOmitEmptyNumberPtr OpType = 171 + OpStructHeadArrayPtr OpType = 172 + OpStructHeadOmitEmptyArrayPtr OpType = 173 + OpStructPtrHeadArrayPtr OpType = 174 + OpStructPtrHeadOmitEmptyArrayPtr OpType = 175 + OpStructHeadMapPtr OpType = 176 + OpStructHeadOmitEmptyMapPtr OpType = 177 + OpStructPtrHeadMapPtr OpType = 178 + OpStructPtrHeadOmitEmptyMapPtr OpType = 179 + OpStructHeadSlicePtr OpType = 180 + OpStructHeadOmitEmptySlicePtr OpType = 181 + OpStructPtrHeadSlicePtr OpType = 182 + OpStructPtrHeadOmitEmptySlicePtr OpType = 183 + OpStructHeadMarshalJSONPtr OpType = 184 + OpStructHeadOmitEmptyMarshalJSONPtr OpType = 185 + OpStructPtrHeadMarshalJSONPtr OpType = 186 + OpStructPtrHeadOmitEmptyMarshalJSONPtr OpType = 187 + OpStructHeadMarshalTextPtr OpType = 188 + OpStructHeadOmitEmptyMarshalTextPtr OpType = 189 + OpStructPtrHeadMarshalTextPtr OpType = 190 + OpStructPtrHeadOmitEmptyMarshalTextPtr OpType = 191 + OpStructHeadInterfacePtr OpType = 192 + OpStructHeadOmitEmptyInterfacePtr OpType = 193 + OpStructPtrHeadInterfacePtr OpType = 194 + OpStructPtrHeadOmitEmptyInterfacePtr OpType = 195 + OpStructHeadIntPtrString OpType = 196 + OpStructHeadOmitEmptyIntPtrString OpType = 197 + OpStructPtrHeadIntPtrString OpType = 198 + OpStructPtrHeadOmitEmptyIntPtrString OpType = 199 + OpStructHeadUintPtrString OpType = 200 + OpStructHeadOmitEmptyUintPtrString OpType = 201 + OpStructPtrHeadUintPtrString OpType = 202 + OpStructPtrHeadOmitEmptyUintPtrString OpType = 203 + OpStructHeadFloat32PtrString OpType = 204 + OpStructHeadOmitEmptyFloat32PtrString OpType = 205 + OpStructPtrHeadFloat32PtrString OpType = 206 + OpStructPtrHeadOmitEmptyFloat32PtrString OpType = 207 + OpStructHeadFloat64PtrString OpType = 208 + OpStructHeadOmitEmptyFloat64PtrString OpType = 209 + OpStructPtrHeadFloat64PtrString OpType = 210 + OpStructPtrHeadOmitEmptyFloat64PtrString OpType = 211 + OpStructHeadBoolPtrString OpType = 212 + OpStructHeadOmitEmptyBoolPtrString OpType = 213 + OpStructPtrHeadBoolPtrString OpType = 214 + OpStructPtrHeadOmitEmptyBoolPtrString OpType = 215 + OpStructHeadStringPtrString OpType = 216 + OpStructHeadOmitEmptyStringPtrString OpType = 217 + OpStructPtrHeadStringPtrString OpType = 218 + OpStructPtrHeadOmitEmptyStringPtrString OpType = 219 + OpStructHeadNumberPtrString OpType = 220 + OpStructHeadOmitEmptyNumberPtrString OpType = 221 + OpStructPtrHeadNumberPtrString OpType = 222 + OpStructPtrHeadOmitEmptyNumberPtrString OpType = 223 + OpStructHead OpType = 224 + OpStructHeadOmitEmpty OpType = 225 + OpStructPtrHead OpType = 226 + OpStructPtrHeadOmitEmpty OpType = 227 + OpStructFieldInt OpType = 228 + OpStructFieldOmitEmptyInt OpType = 229 + OpStructEndInt OpType = 230 + OpStructEndOmitEmptyInt OpType = 231 + OpStructFieldUint OpType = 232 + OpStructFieldOmitEmptyUint OpType = 233 + OpStructEndUint OpType = 234 + OpStructEndOmitEmptyUint OpType = 235 + OpStructFieldFloat32 OpType = 236 + OpStructFieldOmitEmptyFloat32 OpType = 237 + OpStructEndFloat32 OpType = 238 + OpStructEndOmitEmptyFloat32 OpType = 239 + OpStructFieldFloat64 OpType = 240 + OpStructFieldOmitEmptyFloat64 OpType = 241 + OpStructEndFloat64 OpType = 242 + OpStructEndOmitEmptyFloat64 OpType = 243 + OpStructFieldBool OpType = 244 + OpStructFieldOmitEmptyBool OpType = 245 + OpStructEndBool OpType = 246 + OpStructEndOmitEmptyBool OpType = 247 + OpStructFieldString OpType = 248 + OpStructFieldOmitEmptyString OpType = 249 + OpStructEndString OpType = 250 + OpStructEndOmitEmptyString OpType = 251 + OpStructFieldBytes OpType = 252 + OpStructFieldOmitEmptyBytes OpType = 253 + OpStructEndBytes OpType = 254 + OpStructEndOmitEmptyBytes OpType = 255 + OpStructFieldNumber OpType = 256 + OpStructFieldOmitEmptyNumber OpType = 257 + OpStructEndNumber OpType = 258 + OpStructEndOmitEmptyNumber OpType = 259 + OpStructFieldArray OpType = 260 + OpStructFieldOmitEmptyArray OpType = 261 + OpStructEndArray OpType = 262 + OpStructEndOmitEmptyArray OpType = 263 + OpStructFieldMap OpType = 264 + OpStructFieldOmitEmptyMap OpType = 265 + OpStructEndMap OpType = 266 + OpStructEndOmitEmptyMap OpType = 267 + OpStructFieldSlice OpType = 268 + OpStructFieldOmitEmptySlice OpType = 269 + OpStructEndSlice OpType = 270 + OpStructEndOmitEmptySlice OpType = 271 + OpStructFieldStruct OpType = 272 + OpStructFieldOmitEmptyStruct OpType = 273 + OpStructEndStruct OpType = 274 + OpStructEndOmitEmptyStruct OpType = 275 + OpStructFieldMarshalJSON OpType = 276 + OpStructFieldOmitEmptyMarshalJSON OpType = 277 + OpStructEndMarshalJSON OpType = 278 + OpStructEndOmitEmptyMarshalJSON OpType = 279 + OpStructFieldMarshalText OpType = 280 + OpStructFieldOmitEmptyMarshalText OpType = 281 + OpStructEndMarshalText OpType = 282 + OpStructEndOmitEmptyMarshalText OpType = 283 + OpStructFieldIntString OpType = 284 + OpStructFieldOmitEmptyIntString OpType = 285 + OpStructEndIntString OpType = 286 + OpStructEndOmitEmptyIntString OpType = 287 + OpStructFieldUintString OpType = 288 + OpStructFieldOmitEmptyUintString OpType = 289 + OpStructEndUintString OpType = 290 + OpStructEndOmitEmptyUintString OpType = 291 + OpStructFieldFloat32String OpType = 292 + OpStructFieldOmitEmptyFloat32String OpType = 293 + OpStructEndFloat32String OpType = 294 + OpStructEndOmitEmptyFloat32String OpType = 295 + OpStructFieldFloat64String OpType = 296 + OpStructFieldOmitEmptyFloat64String OpType = 297 + OpStructEndFloat64String OpType = 298 + OpStructEndOmitEmptyFloat64String OpType = 299 + OpStructFieldBoolString OpType = 300 + OpStructFieldOmitEmptyBoolString OpType = 301 + OpStructEndBoolString OpType = 302 + OpStructEndOmitEmptyBoolString OpType = 303 + OpStructFieldStringString OpType = 304 + OpStructFieldOmitEmptyStringString OpType = 305 + OpStructEndStringString OpType = 306 + OpStructEndOmitEmptyStringString OpType = 307 + OpStructFieldNumberString OpType = 308 + OpStructFieldOmitEmptyNumberString OpType = 309 + OpStructEndNumberString OpType = 310 + OpStructEndOmitEmptyNumberString OpType = 311 + OpStructFieldIntPtr OpType = 312 + OpStructFieldOmitEmptyIntPtr OpType = 313 + OpStructEndIntPtr OpType = 314 + OpStructEndOmitEmptyIntPtr OpType = 315 + OpStructFieldUintPtr OpType = 316 + OpStructFieldOmitEmptyUintPtr OpType = 317 + OpStructEndUintPtr OpType = 318 + OpStructEndOmitEmptyUintPtr OpType = 319 + OpStructFieldFloat32Ptr OpType = 320 + OpStructFieldOmitEmptyFloat32Ptr OpType = 321 + OpStructEndFloat32Ptr OpType = 322 + OpStructEndOmitEmptyFloat32Ptr OpType = 323 + OpStructFieldFloat64Ptr OpType = 324 + OpStructFieldOmitEmptyFloat64Ptr OpType = 325 + OpStructEndFloat64Ptr OpType = 326 + OpStructEndOmitEmptyFloat64Ptr OpType = 327 + OpStructFieldBoolPtr OpType = 328 + OpStructFieldOmitEmptyBoolPtr OpType = 329 + OpStructEndBoolPtr OpType = 330 + OpStructEndOmitEmptyBoolPtr OpType = 331 + OpStructFieldStringPtr OpType = 332 + OpStructFieldOmitEmptyStringPtr OpType = 333 + OpStructEndStringPtr OpType = 334 + OpStructEndOmitEmptyStringPtr OpType = 335 + OpStructFieldBytesPtr OpType = 336 + OpStructFieldOmitEmptyBytesPtr OpType = 337 + OpStructEndBytesPtr OpType = 338 + OpStructEndOmitEmptyBytesPtr OpType = 339 + OpStructFieldNumberPtr OpType = 340 + OpStructFieldOmitEmptyNumberPtr OpType = 341 + OpStructEndNumberPtr OpType = 342 + OpStructEndOmitEmptyNumberPtr OpType = 343 + OpStructFieldArrayPtr OpType = 344 + OpStructFieldOmitEmptyArrayPtr OpType = 345 + OpStructEndArrayPtr OpType = 346 + OpStructEndOmitEmptyArrayPtr OpType = 347 + OpStructFieldMapPtr OpType = 348 + OpStructFieldOmitEmptyMapPtr OpType = 349 + OpStructEndMapPtr OpType = 350 + OpStructEndOmitEmptyMapPtr OpType = 351 + OpStructFieldSlicePtr OpType = 352 + OpStructFieldOmitEmptySlicePtr OpType = 353 + OpStructEndSlicePtr OpType = 354 + OpStructEndOmitEmptySlicePtr OpType = 355 + OpStructFieldMarshalJSONPtr OpType = 356 + OpStructFieldOmitEmptyMarshalJSONPtr OpType = 357 + OpStructEndMarshalJSONPtr OpType = 358 + OpStructEndOmitEmptyMarshalJSONPtr OpType = 359 + OpStructFieldMarshalTextPtr OpType = 360 + OpStructFieldOmitEmptyMarshalTextPtr OpType = 361 + OpStructEndMarshalTextPtr OpType = 362 + OpStructEndOmitEmptyMarshalTextPtr OpType = 363 + OpStructFieldInterfacePtr OpType = 364 + OpStructFieldOmitEmptyInterfacePtr OpType = 365 + OpStructEndInterfacePtr OpType = 366 + OpStructEndOmitEmptyInterfacePtr OpType = 367 + OpStructFieldIntPtrString OpType = 368 + OpStructFieldOmitEmptyIntPtrString OpType = 369 + OpStructEndIntPtrString OpType = 370 + OpStructEndOmitEmptyIntPtrString OpType = 371 + OpStructFieldUintPtrString OpType = 372 + OpStructFieldOmitEmptyUintPtrString OpType = 373 + OpStructEndUintPtrString OpType = 374 + OpStructEndOmitEmptyUintPtrString OpType = 375 + OpStructFieldFloat32PtrString OpType = 376 + OpStructFieldOmitEmptyFloat32PtrString OpType = 377 + OpStructEndFloat32PtrString OpType = 378 + OpStructEndOmitEmptyFloat32PtrString OpType = 379 + OpStructFieldFloat64PtrString OpType = 380 + OpStructFieldOmitEmptyFloat64PtrString OpType = 381 + OpStructEndFloat64PtrString OpType = 382 + OpStructEndOmitEmptyFloat64PtrString OpType = 383 + OpStructFieldBoolPtrString OpType = 384 + OpStructFieldOmitEmptyBoolPtrString OpType = 385 + OpStructEndBoolPtrString OpType = 386 + OpStructEndOmitEmptyBoolPtrString OpType = 387 + OpStructFieldStringPtrString OpType = 388 + OpStructFieldOmitEmptyStringPtrString OpType = 389 + OpStructEndStringPtrString OpType = 390 + OpStructEndOmitEmptyStringPtrString OpType = 391 + OpStructFieldNumberPtrString OpType = 392 + OpStructFieldOmitEmptyNumberPtrString OpType = 393 + OpStructEndNumberPtrString OpType = 394 + OpStructEndOmitEmptyNumberPtrString OpType = 395 + OpStructField OpType = 396 + OpStructFieldOmitEmpty OpType = 397 + OpStructEnd OpType = 398 + OpStructEndOmitEmpty OpType = 399 ) func (t OpType) String() string { - if int(t) >= 416 { + if int(t) >= 400 { return "" } return opTypeStrings[int(t)] @@ -909,7 +877,7 @@ func (t OpType) HeadToPtrHead() OpType { } suffix := "PtrHead" + t.String()[idx+len("Head"):] - const toPtrOffset = 3 + const toPtrOffset = 2 if strings.Contains(OpType(int(t)+toPtrOffset).String(), suffix) { return OpType(int(t) + toPtrOffset) } @@ -925,14 +893,6 @@ func (t OpType) HeadToOmitEmptyHead() OpType { return t } -func (t OpType) HeadToStringTagHead() OpType { - const toStringTagOffset = 2 - if strings.Contains(OpType(int(t)+toStringTagOffset).String(), "StringTag") { - return OpType(int(t) + toStringTagOffset) - } - return t -} - func (t OpType) PtrHeadToHead() OpType { idx := strings.Index(t.String(), "Ptr") if idx == -1 { @@ -940,7 +900,7 @@ func (t OpType) PtrHeadToHead() OpType { } suffix := t.String()[idx+len("Ptr"):] - const toPtrOffset = 3 + const toPtrOffset = 2 if strings.Contains(OpType(int(t)-toPtrOffset).String(), suffix) { return OpType(int(t) - toPtrOffset) } @@ -953,10 +913,10 @@ func (t OpType) FieldToEnd() OpType { return t } suffix := t.String()[idx+len("Field"):] - if suffix == "" || suffix == "OmitEmpty" || suffix == "StringTag" { + if suffix == "" || suffix == "OmitEmpty" { return t } - const toEndOffset = 3 + const toEndOffset = 2 if strings.Contains(OpType(int(t)+toEndOffset).String(), "End"+suffix) { return OpType(int(t) + toEndOffset) } @@ -970,11 +930,3 @@ func (t OpType) FieldToOmitEmptyField() OpType { } return t } - -func (t OpType) FieldToStringTagField() OpType { - const toStringTagOffset = 2 - if strings.Contains(OpType(int(t)+toStringTagOffset).String(), "StringTag") { - return OpType(int(t) + toStringTagOffset) - } - return t -} diff --git a/internal/encoder/vm/vm.go b/internal/encoder/vm/vm.go index ac2997a..55c7a8f 100644 --- a/internal/encoder/vm/vm.go +++ b/internal/encoder/vm/vm.go @@ -628,35 +628,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadStringTag: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadStringTag: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{') - } - p += code.Offset - b = append(b, code.Key...) - code = code.Next - store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadInt: if code.Indirect { p := load(ctxptr, code.Idx) @@ -725,7 +696,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagInt: + case encoder.OpStructPtrHeadIntString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -739,7 +710,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagInt: + case encoder.OpStructHeadIntString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -828,7 +799,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagIntPtr: + case encoder.OpStructPtrHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -840,7 +811,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagIntPtr: + case encoder.OpStructHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -934,7 +905,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagUint: + case encoder.OpStructPtrHeadUintString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -948,7 +919,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagUint: + case encoder.OpStructHeadUintString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1037,7 +1008,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagUintPtr: + case encoder.OpStructPtrHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1049,7 +1020,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagUintPtr: + case encoder.OpStructHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1142,7 +1113,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagFloat32: + case encoder.OpStructPtrHeadFloat32String: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1156,7 +1127,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagFloat32: + case encoder.OpStructHeadFloat32String: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1245,7 +1216,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagFloat32Ptr: + case encoder.OpStructPtrHeadFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1257,7 +1228,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagFloat32Ptr: + case encoder.OpStructHeadFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1357,7 +1328,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagFloat64: + case encoder.OpStructPtrHeadFloat64String: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1371,7 +1342,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagFloat64: + case encoder.OpStructHeadFloat64String: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1472,7 +1443,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagFloat64Ptr: + case encoder.OpStructPtrHeadFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1484,7 +1455,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagFloat64Ptr: + case encoder.OpStructHeadFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1581,7 +1552,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagString: + case encoder.OpStructPtrHeadStringString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1595,7 +1566,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagString: + case encoder.OpStructHeadStringString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1683,7 +1654,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagStringPtr: + case encoder.OpStructPtrHeadStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1695,7 +1666,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagStringPtr: + case encoder.OpStructHeadStringPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1786,7 +1757,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } else { code = code.NextField } - case encoder.OpStructPtrHeadStringTagBool: + case encoder.OpStructPtrHeadBoolString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1800,7 +1771,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagBool: + case encoder.OpStructHeadBoolString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1889,7 +1860,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagBoolPtr: + case encoder.OpStructPtrHeadBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1901,7 +1872,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagBoolPtr: + case encoder.OpStructHeadBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1994,37 +1965,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagBytes: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadStringTagBytes: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{') - } - b = append(b, code.Key...) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { @@ -2095,42 +2035,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadStringTagBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{') - } - b = append(b, code.Key...) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadNumber: if code.Indirect { p := load(ctxptr, code.Idx) @@ -2204,7 +2108,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) code = code.Next } - case encoder.OpStructPtrHeadStringTagNumber: + case encoder.OpStructPtrHeadNumberString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -2218,7 +2122,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagNumber: + case encoder.OpStructHeadNumberString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2317,7 +2221,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructPtrHeadStringTagNumberPtr: + case encoder.OpStructPtrHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2329,7 +2233,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagNumberPtr: + case encoder.OpStructHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2358,8 +2262,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadStringTagArray, - encoder.OpStructPtrHeadSlice, encoder.OpStructPtrHeadStringTagSlice: + case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -2373,8 +2276,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadArray, encoder.OpStructHeadStringTagArray, - encoder.OpStructHeadSlice, encoder.OpStructHeadStringTagSlice: + case encoder.OpStructHeadArray, encoder.OpStructHeadSlice: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2458,8 +2360,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadStringTagArrayPtr, - encoder.OpStructPtrHeadSlicePtr, encoder.OpStructPtrHeadStringTagSlicePtr: + case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2471,8 +2372,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadStringTagArrayPtr, - encoder.OpStructHeadSlicePtr, encoder.OpStructHeadStringTagSlicePtr: + case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2532,7 +2432,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadMap, encoder.OpStructPtrHeadStringTagMap: + case encoder.OpStructPtrHeadMap: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2544,7 +2444,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMap, encoder.OpStructHeadStringTagMap: + case encoder.OpStructHeadMap: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2598,7 +2498,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadMapPtr, encoder.OpStructPtrHeadStringTagMapPtr: + case encoder.OpStructPtrHeadMapPtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2610,7 +2510,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMapPtr, encoder.OpStructHeadStringTagMapPtr: + case encoder.OpStructHeadMapPtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2726,50 +2626,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructPtrHeadStringTagMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadStringTagMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{') - } - b = append(b, code.Key...) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadStringTagMarshalJSON { - p = ptrToPtr(p + code.Offset) - } - } - if p == 0 && code.Nilcheck { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), false) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { @@ -2815,7 +2671,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadMarshalJSONPtr, encoder.OpStructPtrHeadStringTagMarshalJSONPtr: + case encoder.OpStructPtrHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2827,7 +2683,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMarshalJSONPtr, encoder.OpStructHeadStringTagMarshalJSONPtr: + case encoder.OpStructHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2939,50 +2795,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructPtrHeadStringTagMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadStringTagMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{') - } - b = append(b, code.Key...) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadStringTagMarshalText { - p = ptrToPtr(p + code.Offset) - } - } - if p == 0 && code.Nilcheck { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p), false) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) if p == 0 { @@ -3027,7 +2839,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadMarshalTextPtr, encoder.OpStructPtrHeadStringTagMarshalTextPtr: + case encoder.OpStructPtrHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -3039,7 +2851,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMarshalTextPtr, encoder.OpStructHeadStringTagMarshalTextPtr: + case encoder.OpStructHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -3124,12 +2936,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructFieldStringTag: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - b = append(b, code.Key...) - code = code.Next - store(ctxptr, code.Idx, p) case encoder.OpStructFieldInt: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) @@ -3146,7 +2952,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagInt: + case encoder.OpStructFieldIntString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -3174,7 +2980,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagIntPtr: + case encoder.OpStructFieldIntPtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = append(b, code.Key...) @@ -3203,7 +3009,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagUint: + case encoder.OpStructFieldUintString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -3231,7 +3037,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagUintPtr: + case encoder.OpStructFieldUintPtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = append(b, code.Key...) @@ -3259,7 +3065,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat32: + case encoder.OpStructFieldFloat32String: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -3287,7 +3093,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat32Ptr: + case encoder.OpStructFieldFloat32PtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = append(b, code.Key...) @@ -3322,7 +3128,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat64: + case encoder.OpStructFieldFloat64String: p := load(ctxptr, code.HeadIdx) v := ptrToFloat64(p + code.Offset) if math.IsInf(v, 0) || math.IsNaN(v) { @@ -3364,7 +3170,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat64Ptr: + case encoder.OpStructFieldFloat64PtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = append(b, code.Key...) @@ -3396,7 +3202,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagString: + case encoder.OpStructFieldStringString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) s := ptrToString(p + code.Offset) @@ -3423,7 +3229,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagStringPtr: + case encoder.OpStructFieldStringPtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3449,7 +3255,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBool: + case encoder.OpStructFieldBoolString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -3477,7 +3283,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBoolPtr: + case encoder.OpStructFieldBoolPtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3505,13 +3311,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) - b = append(b, code.Key...) - b = appendByteSlice(b, v) - b = appendComma(b) - code = code.Next case encoder.OpStructFieldBytesPtr: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) @@ -3532,17 +3331,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBytesPtr: - b = append(b, code.Key...) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendComma(b) - code = code.Next case encoder.OpStructFieldNumber: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) @@ -3564,7 +3352,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldStringTagNumber: + case encoder.OpStructFieldNumberString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -3602,7 +3390,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldStringTagNumberPtr: + case encoder.OpStructFieldNumberPtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3618,7 +3406,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructFieldMarshalJSON, encoder.OpStructFieldStringTagMarshalJSON: + case encoder.OpStructFieldMarshalJSON: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) p += code.Offset @@ -3658,7 +3446,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(bb) code = code.Next - case encoder.OpStructFieldMarshalJSONPtr, encoder.OpStructFieldStringTagMarshalJSONPtr: + case encoder.OpStructFieldMarshalJSONPtr: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3685,7 +3473,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldMarshalText, encoder.OpStructFieldStringTagMarshalText: + case encoder.OpStructFieldMarshalText: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) p += code.Offset @@ -3720,7 +3508,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(bb) code = code.Next - case encoder.OpStructFieldMarshalTextPtr, encoder.OpStructFieldStringTagMarshalTextPtr: + case encoder.OpStructFieldMarshalTextPtr: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3747,7 +3535,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldArray, encoder.OpStructFieldStringTagArray: + case encoder.OpStructFieldArray: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p += code.Offset @@ -3759,7 +3547,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = append(b, code.Key...) code = code.Next store(ctxptr, code.Idx, p) - case encoder.OpStructFieldArrayPtr, encoder.OpStructFieldStringTagArrayPtr: + case encoder.OpStructFieldArrayPtr: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3775,7 +3563,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } else { code = code.NextField } - case encoder.OpStructFieldSlice, encoder.OpStructFieldStringTagSlice: + case encoder.OpStructFieldSlice: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p += code.Offset @@ -3792,7 +3580,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructFieldSlicePtr, encoder.OpStructFieldStringTagSlicePtr: + case encoder.OpStructFieldSlicePtr: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3808,7 +3596,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } else { code = code.NextField } - case encoder.OpStructFieldMap, encoder.OpStructFieldStringTagMap: + case encoder.OpStructFieldMap: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToPtr(p + code.Offset) @@ -3824,7 +3612,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructFieldMapPtr, encoder.OpStructFieldStringTagMapPtr: + case encoder.OpStructFieldMapPtr: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToPtr(p + code.Offset) @@ -3887,7 +3675,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagInt: + case encoder.OpStructEndIntString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -3923,7 +3711,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagIntPtr: + case encoder.OpStructEndIntPtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3960,7 +3748,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagUint: + case encoder.OpStructEndUintString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -3996,7 +3784,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagUintPtr: + case encoder.OpStructEndUintPtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -4032,7 +3820,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagFloat32: + case encoder.OpStructEndFloat32String: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -4068,7 +3856,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagFloat32Ptr: + case encoder.OpStructEndFloat32PtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -4111,7 +3899,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagFloat64: + case encoder.OpStructEndFloat64String: p := load(ctxptr, code.HeadIdx) v := ptrToFloat64(p + code.Offset) if math.IsInf(v, 0) || math.IsNaN(v) { @@ -4161,7 +3949,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagFloat64Ptr: + case encoder.OpStructEndFloat64PtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -4201,7 +3989,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagString: + case encoder.OpStructEndStringString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) s := ptrToString(p + code.Offset) @@ -4236,7 +4024,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagStringPtr: + case encoder.OpStructEndStringPtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -4271,7 +4059,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagBool: + case encoder.OpStructEndBoolString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -4307,7 +4095,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagBoolPtr: + case encoder.OpStructEndBoolPtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -4343,13 +4131,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) - b = append(b, code.Key...) - b = appendByteSlice(b, v) - b = appendStructEnd(b) - code = code.Next case encoder.OpStructEndBytesPtr: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) @@ -4378,17 +4159,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagBytesPtr: - b = append(b, code.Key...) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendStructEnd(b) - code = code.Next case encoder.OpStructEndNumber: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) @@ -4418,7 +4188,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagNumber: + case encoder.OpStructEndNumberString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -4464,7 +4234,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagNumberPtr: + case encoder.OpStructEndNumberPtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) diff --git a/internal/encoder/vm_debug/vm.go b/internal/encoder/vm_debug/vm.go index 88809f7..31490c4 100644 --- a/internal/encoder/vm_debug/vm.go +++ b/internal/encoder/vm_debug/vm.go @@ -641,35 +641,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadStringTag: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadStringTag: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{') - } - p += code.Offset - b = append(b, code.Key...) - code = code.Next - store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadInt: if code.Indirect { p := load(ctxptr, code.Idx) @@ -738,7 +709,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagInt: + case encoder.OpStructPtrHeadIntString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -752,7 +723,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagInt: + case encoder.OpStructHeadIntString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -841,7 +812,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagIntPtr: + case encoder.OpStructPtrHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -853,7 +824,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagIntPtr: + case encoder.OpStructHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -947,7 +918,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagUint: + case encoder.OpStructPtrHeadUintString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -961,7 +932,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagUint: + case encoder.OpStructHeadUintString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1050,7 +1021,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagUintPtr: + case encoder.OpStructPtrHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1062,7 +1033,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagUintPtr: + case encoder.OpStructHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1155,7 +1126,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagFloat32: + case encoder.OpStructPtrHeadFloat32String: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1169,7 +1140,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagFloat32: + case encoder.OpStructHeadFloat32String: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1258,7 +1229,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagFloat32Ptr: + case encoder.OpStructPtrHeadFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1270,7 +1241,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagFloat32Ptr: + case encoder.OpStructHeadFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1370,7 +1341,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagFloat64: + case encoder.OpStructPtrHeadFloat64String: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1384,7 +1355,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagFloat64: + case encoder.OpStructHeadFloat64String: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1485,7 +1456,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagFloat64Ptr: + case encoder.OpStructPtrHeadFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1497,7 +1468,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagFloat64Ptr: + case encoder.OpStructHeadFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1594,7 +1565,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagString: + case encoder.OpStructPtrHeadStringString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1608,7 +1579,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagString: + case encoder.OpStructHeadStringString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1696,7 +1667,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagStringPtr: + case encoder.OpStructPtrHeadStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1708,7 +1679,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagStringPtr: + case encoder.OpStructHeadStringPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1799,7 +1770,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } else { code = code.NextField } - case encoder.OpStructPtrHeadStringTagBool: + case encoder.OpStructPtrHeadBoolString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1813,7 +1784,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagBool: + case encoder.OpStructHeadBoolString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1902,7 +1873,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagBoolPtr: + case encoder.OpStructPtrHeadBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1914,7 +1885,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagBoolPtr: + case encoder.OpStructHeadBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2007,37 +1978,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagBytes: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadStringTagBytes: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{') - } - b = append(b, code.Key...) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { @@ -2108,42 +2048,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadStringTagBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{') - } - b = append(b, code.Key...) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadNumber: if code.Indirect { p := load(ctxptr, code.Idx) @@ -2217,7 +2121,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) code = code.Next } - case encoder.OpStructPtrHeadStringTagNumber: + case encoder.OpStructPtrHeadNumberString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -2231,7 +2135,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagNumber: + case encoder.OpStructHeadNumberString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2330,7 +2234,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructPtrHeadStringTagNumberPtr: + case encoder.OpStructPtrHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2342,7 +2246,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagNumberPtr: + case encoder.OpStructHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2371,8 +2275,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadStringTagArray, - encoder.OpStructPtrHeadSlice, encoder.OpStructPtrHeadStringTagSlice: + case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -2386,8 +2289,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadArray, encoder.OpStructHeadStringTagArray, - encoder.OpStructHeadSlice, encoder.OpStructHeadStringTagSlice: + case encoder.OpStructHeadArray, encoder.OpStructHeadSlice: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2471,8 +2373,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadStringTagArrayPtr, - encoder.OpStructPtrHeadSlicePtr, encoder.OpStructPtrHeadStringTagSlicePtr: + case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2484,8 +2385,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadStringTagArrayPtr, - encoder.OpStructHeadSlicePtr, encoder.OpStructHeadStringTagSlicePtr: + case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2545,7 +2445,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadMap, encoder.OpStructPtrHeadStringTagMap: + case encoder.OpStructPtrHeadMap: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2557,7 +2457,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMap, encoder.OpStructHeadStringTagMap: + case encoder.OpStructHeadMap: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2611,7 +2511,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadMapPtr, encoder.OpStructPtrHeadStringTagMapPtr: + case encoder.OpStructPtrHeadMapPtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2623,7 +2523,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMapPtr, encoder.OpStructHeadStringTagMapPtr: + case encoder.OpStructHeadMapPtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2739,50 +2639,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructPtrHeadStringTagMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadStringTagMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{') - } - b = append(b, code.Key...) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadStringTagMarshalJSON { - p = ptrToPtr(p + code.Offset) - } - } - if p == 0 && code.Nilcheck { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), false) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { @@ -2828,7 +2684,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadMarshalJSONPtr, encoder.OpStructPtrHeadStringTagMarshalJSONPtr: + case encoder.OpStructPtrHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2840,7 +2696,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMarshalJSONPtr, encoder.OpStructHeadStringTagMarshalJSONPtr: + case encoder.OpStructHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2952,50 +2808,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructPtrHeadStringTagMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadStringTagMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{') - } - b = append(b, code.Key...) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadStringTagMarshalText { - p = ptrToPtr(p + code.Offset) - } - } - if p == 0 && code.Nilcheck { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p), false) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) if p == 0 { @@ -3040,7 +2852,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadMarshalTextPtr, encoder.OpStructPtrHeadStringTagMarshalTextPtr: + case encoder.OpStructPtrHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -3052,7 +2864,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMarshalTextPtr, encoder.OpStructHeadStringTagMarshalTextPtr: + case encoder.OpStructHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -3137,12 +2949,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructFieldStringTag: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - b = append(b, code.Key...) - code = code.Next - store(ctxptr, code.Idx, p) case encoder.OpStructFieldInt: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) @@ -3159,7 +2965,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagInt: + case encoder.OpStructFieldIntString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -3187,7 +2993,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagIntPtr: + case encoder.OpStructFieldIntPtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = append(b, code.Key...) @@ -3216,7 +3022,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagUint: + case encoder.OpStructFieldUintString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -3244,7 +3050,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagUintPtr: + case encoder.OpStructFieldUintPtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = append(b, code.Key...) @@ -3272,7 +3078,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat32: + case encoder.OpStructFieldFloat32String: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -3300,7 +3106,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat32Ptr: + case encoder.OpStructFieldFloat32PtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = append(b, code.Key...) @@ -3335,7 +3141,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat64: + case encoder.OpStructFieldFloat64String: p := load(ctxptr, code.HeadIdx) v := ptrToFloat64(p + code.Offset) if math.IsInf(v, 0) || math.IsNaN(v) { @@ -3377,7 +3183,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat64Ptr: + case encoder.OpStructFieldFloat64PtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = append(b, code.Key...) @@ -3409,7 +3215,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagString: + case encoder.OpStructFieldStringString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) s := ptrToString(p + code.Offset) @@ -3436,7 +3242,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagStringPtr: + case encoder.OpStructFieldStringPtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3462,7 +3268,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBool: + case encoder.OpStructFieldBoolString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -3490,7 +3296,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBoolPtr: + case encoder.OpStructFieldBoolPtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3518,13 +3324,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) - b = append(b, code.Key...) - b = appendByteSlice(b, v) - b = appendComma(b) - code = code.Next case encoder.OpStructFieldBytesPtr: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) @@ -3545,17 +3344,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBytesPtr: - b = append(b, code.Key...) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendComma(b) - code = code.Next case encoder.OpStructFieldNumber: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) @@ -3577,7 +3365,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldStringTagNumber: + case encoder.OpStructFieldNumberString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -3615,7 +3403,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldStringTagNumberPtr: + case encoder.OpStructFieldNumberPtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3631,7 +3419,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructFieldMarshalJSON, encoder.OpStructFieldStringTagMarshalJSON: + case encoder.OpStructFieldMarshalJSON: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) p += code.Offset @@ -3671,7 +3459,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(bb) code = code.Next - case encoder.OpStructFieldMarshalJSONPtr, encoder.OpStructFieldStringTagMarshalJSONPtr: + case encoder.OpStructFieldMarshalJSONPtr: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3698,7 +3486,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldMarshalText, encoder.OpStructFieldStringTagMarshalText: + case encoder.OpStructFieldMarshalText: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) p += code.Offset @@ -3733,7 +3521,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(bb) code = code.Next - case encoder.OpStructFieldMarshalTextPtr, encoder.OpStructFieldStringTagMarshalTextPtr: + case encoder.OpStructFieldMarshalTextPtr: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3760,7 +3548,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldArray, encoder.OpStructFieldStringTagArray: + case encoder.OpStructFieldArray: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p += code.Offset @@ -3772,7 +3560,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = append(b, code.Key...) code = code.Next store(ctxptr, code.Idx, p) - case encoder.OpStructFieldArrayPtr, encoder.OpStructFieldStringTagArrayPtr: + case encoder.OpStructFieldArrayPtr: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3788,7 +3576,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } else { code = code.NextField } - case encoder.OpStructFieldSlice, encoder.OpStructFieldStringTagSlice: + case encoder.OpStructFieldSlice: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p += code.Offset @@ -3805,7 +3593,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructFieldSlicePtr, encoder.OpStructFieldStringTagSlicePtr: + case encoder.OpStructFieldSlicePtr: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3821,7 +3609,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } else { code = code.NextField } - case encoder.OpStructFieldMap, encoder.OpStructFieldStringTagMap: + case encoder.OpStructFieldMap: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToPtr(p + code.Offset) @@ -3837,7 +3625,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructFieldMapPtr, encoder.OpStructFieldStringTagMapPtr: + case encoder.OpStructFieldMapPtr: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToPtr(p + code.Offset) @@ -3900,7 +3688,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagInt: + case encoder.OpStructEndIntString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -3936,7 +3724,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagIntPtr: + case encoder.OpStructEndIntPtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3973,7 +3761,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagUint: + case encoder.OpStructEndUintString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -4009,7 +3797,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagUintPtr: + case encoder.OpStructEndUintPtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -4045,7 +3833,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagFloat32: + case encoder.OpStructEndFloat32String: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -4081,7 +3869,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagFloat32Ptr: + case encoder.OpStructEndFloat32PtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -4124,7 +3912,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagFloat64: + case encoder.OpStructEndFloat64String: p := load(ctxptr, code.HeadIdx) v := ptrToFloat64(p + code.Offset) if math.IsInf(v, 0) || math.IsNaN(v) { @@ -4174,7 +3962,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagFloat64Ptr: + case encoder.OpStructEndFloat64PtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -4214,7 +4002,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagString: + case encoder.OpStructEndStringString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) s := ptrToString(p + code.Offset) @@ -4249,7 +4037,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagStringPtr: + case encoder.OpStructEndStringPtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -4284,7 +4072,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagBool: + case encoder.OpStructEndBoolString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -4320,7 +4108,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagBoolPtr: + case encoder.OpStructEndBoolPtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -4356,13 +4144,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) - b = append(b, code.Key...) - b = appendByteSlice(b, v) - b = appendStructEnd(b) - code = code.Next case encoder.OpStructEndBytesPtr: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) @@ -4391,17 +4172,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagBytesPtr: - b = append(b, code.Key...) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendStructEnd(b) - code = code.Next case encoder.OpStructEndNumber: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) @@ -4431,7 +4201,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagNumber: + case encoder.OpStructEndNumberString: p := load(ctxptr, code.HeadIdx) b = append(b, code.Key...) b = append(b, '"') @@ -4477,7 +4247,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagNumberPtr: + case encoder.OpStructEndNumberPtrString: b = append(b, code.Key...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) diff --git a/internal/encoder/vm_escaped/vm.go b/internal/encoder/vm_escaped/vm.go index 1daec9d..65458df 100644 --- a/internal/encoder/vm_escaped/vm.go +++ b/internal/encoder/vm_escaped/vm.go @@ -628,35 +628,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadStringTag: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadStringTag: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{') - } - p += code.Offset - b = append(b, code.EscapedKey...) - code = code.Next - store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadInt: if code.Indirect { p := load(ctxptr, code.Idx) @@ -725,7 +696,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagInt: + case encoder.OpStructPtrHeadIntString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -739,7 +710,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagInt: + case encoder.OpStructHeadIntString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -828,7 +799,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagIntPtr: + case encoder.OpStructPtrHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -840,7 +811,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagIntPtr: + case encoder.OpStructHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -934,7 +905,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagUint: + case encoder.OpStructPtrHeadUintString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -948,7 +919,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagUint: + case encoder.OpStructHeadUintString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1037,7 +1008,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagUintPtr: + case encoder.OpStructPtrHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1049,7 +1020,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagUintPtr: + case encoder.OpStructHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1142,7 +1113,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagFloat32: + case encoder.OpStructPtrHeadFloat32String: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1156,7 +1127,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagFloat32: + case encoder.OpStructHeadFloat32String: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1245,7 +1216,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagFloat32Ptr: + case encoder.OpStructPtrHeadFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1257,7 +1228,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagFloat32Ptr: + case encoder.OpStructHeadFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1357,7 +1328,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagFloat64: + case encoder.OpStructPtrHeadFloat64String: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1371,7 +1342,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagFloat64: + case encoder.OpStructHeadFloat64String: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1472,7 +1443,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagFloat64Ptr: + case encoder.OpStructPtrHeadFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1484,7 +1455,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagFloat64Ptr: + case encoder.OpStructHeadFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1581,7 +1552,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagString: + case encoder.OpStructPtrHeadStringString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1595,7 +1566,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagString: + case encoder.OpStructHeadStringString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1683,7 +1654,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagStringPtr: + case encoder.OpStructPtrHeadStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1695,7 +1666,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagStringPtr: + case encoder.OpStructHeadStringPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1786,7 +1757,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } else { code = code.NextField } - case encoder.OpStructPtrHeadStringTagBool: + case encoder.OpStructPtrHeadBoolString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1800,7 +1771,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagBool: + case encoder.OpStructHeadBoolString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1889,7 +1860,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagBoolPtr: + case encoder.OpStructPtrHeadBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1901,7 +1872,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagBoolPtr: + case encoder.OpStructHeadBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1994,37 +1965,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagBytes: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadStringTagBytes: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{') - } - b = append(b, code.EscapedKey...) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { @@ -2095,42 +2035,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadStringTagBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{') - } - b = append(b, code.EscapedKey...) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadNumber: if code.Indirect { p := load(ctxptr, code.Idx) @@ -2204,7 +2108,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) code = code.Next } - case encoder.OpStructPtrHeadStringTagNumber: + case encoder.OpStructPtrHeadNumberString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -2218,7 +2122,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagNumber: + case encoder.OpStructHeadNumberString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2317,7 +2221,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructPtrHeadStringTagNumberPtr: + case encoder.OpStructPtrHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2329,7 +2233,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagNumberPtr: + case encoder.OpStructHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2358,8 +2262,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadStringTagArray, - encoder.OpStructPtrHeadSlice, encoder.OpStructPtrHeadStringTagSlice: + case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -2373,8 +2276,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadArray, encoder.OpStructHeadStringTagArray, - encoder.OpStructHeadSlice, encoder.OpStructHeadStringTagSlice: + case encoder.OpStructHeadArray, encoder.OpStructHeadSlice: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2458,8 +2360,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadStringTagArrayPtr, - encoder.OpStructPtrHeadSlicePtr, encoder.OpStructPtrHeadStringTagSlicePtr: + case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2471,8 +2372,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadStringTagArrayPtr, - encoder.OpStructHeadSlicePtr, encoder.OpStructHeadStringTagSlicePtr: + case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2532,7 +2432,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadMap, encoder.OpStructPtrHeadStringTagMap: + case encoder.OpStructPtrHeadMap: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2544,7 +2444,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMap, encoder.OpStructHeadStringTagMap: + case encoder.OpStructHeadMap: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2598,7 +2498,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadMapPtr, encoder.OpStructPtrHeadStringTagMapPtr: + case encoder.OpStructPtrHeadMapPtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2610,7 +2510,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMapPtr, encoder.OpStructHeadStringTagMapPtr: + case encoder.OpStructHeadMapPtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2726,50 +2626,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructPtrHeadStringTagMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadStringTagMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{') - } - b = append(b, code.EscapedKey...) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadStringTagMarshalJSON { - p = ptrToPtr(p + code.Offset) - } - } - if p == 0 && code.Nilcheck { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), true) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { @@ -2815,7 +2671,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadMarshalJSONPtr, encoder.OpStructPtrHeadStringTagMarshalJSONPtr: + case encoder.OpStructPtrHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2827,7 +2683,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMarshalJSONPtr, encoder.OpStructHeadStringTagMarshalJSONPtr: + case encoder.OpStructHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2939,50 +2795,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructPtrHeadStringTagMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadStringTagMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{') - } - b = append(b, code.EscapedKey...) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadStringTagMarshalText { - p = ptrToPtr(p + code.Offset) - } - } - if p == 0 && code.Nilcheck { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p), true) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) if p == 0 { @@ -3027,7 +2839,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadMarshalTextPtr, encoder.OpStructPtrHeadStringTagMarshalTextPtr: + case encoder.OpStructPtrHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -3039,7 +2851,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMarshalTextPtr, encoder.OpStructHeadStringTagMarshalTextPtr: + case encoder.OpStructHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -3124,12 +2936,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructFieldStringTag: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - b = append(b, code.EscapedKey...) - code = code.Next - store(ctxptr, code.Idx, p) case encoder.OpStructFieldInt: p := load(ctxptr, code.HeadIdx) b = append(b, code.EscapedKey...) @@ -3146,7 +2952,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagInt: + case encoder.OpStructFieldIntString: p := load(ctxptr, code.HeadIdx) b = append(b, code.EscapedKey...) b = append(b, '"') @@ -3174,7 +2980,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagIntPtr: + case encoder.OpStructFieldIntPtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = append(b, code.EscapedKey...) @@ -3203,7 +3009,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagUint: + case encoder.OpStructFieldUintString: p := load(ctxptr, code.HeadIdx) b = append(b, code.EscapedKey...) b = append(b, '"') @@ -3231,7 +3037,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagUintPtr: + case encoder.OpStructFieldUintPtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = append(b, code.EscapedKey...) @@ -3259,7 +3065,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat32: + case encoder.OpStructFieldFloat32String: p := load(ctxptr, code.HeadIdx) b = append(b, code.EscapedKey...) b = append(b, '"') @@ -3287,7 +3093,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat32Ptr: + case encoder.OpStructFieldFloat32PtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = append(b, code.EscapedKey...) @@ -3322,7 +3128,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat64: + case encoder.OpStructFieldFloat64String: p := load(ctxptr, code.HeadIdx) v := ptrToFloat64(p + code.Offset) if math.IsInf(v, 0) || math.IsNaN(v) { @@ -3364,7 +3170,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat64Ptr: + case encoder.OpStructFieldFloat64PtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = append(b, code.EscapedKey...) @@ -3396,7 +3202,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagString: + case encoder.OpStructFieldStringString: p := load(ctxptr, code.HeadIdx) b = append(b, code.EscapedKey...) s := ptrToString(p + code.Offset) @@ -3423,7 +3229,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagStringPtr: + case encoder.OpStructFieldStringPtrString: b = append(b, code.EscapedKey...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3449,7 +3255,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBool: + case encoder.OpStructFieldBoolString: p := load(ctxptr, code.HeadIdx) b = append(b, code.EscapedKey...) b = append(b, '"') @@ -3477,7 +3283,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBoolPtr: + case encoder.OpStructFieldBoolPtrString: b = append(b, code.EscapedKey...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3505,13 +3311,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) - b = append(b, code.EscapedKey...) - b = appendByteSlice(b, v) - b = appendComma(b) - code = code.Next case encoder.OpStructFieldBytesPtr: b = append(b, code.EscapedKey...) p := load(ctxptr, code.HeadIdx) @@ -3532,17 +3331,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBytesPtr: - b = append(b, code.EscapedKey...) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendComma(b) - code = code.Next case encoder.OpStructFieldNumber: p := load(ctxptr, code.HeadIdx) b = append(b, code.EscapedKey...) @@ -3564,7 +3352,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldStringTagNumber: + case encoder.OpStructFieldNumberString: p := load(ctxptr, code.HeadIdx) b = append(b, code.EscapedKey...) b = append(b, '"') @@ -3602,7 +3390,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldStringTagNumberPtr: + case encoder.OpStructFieldNumberPtrString: b = append(b, code.EscapedKey...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3618,7 +3406,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructFieldMarshalJSON, encoder.OpStructFieldStringTagMarshalJSON: + case encoder.OpStructFieldMarshalJSON: p := load(ctxptr, code.HeadIdx) b = append(b, code.EscapedKey...) p += code.Offset @@ -3658,7 +3446,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(bb) code = code.Next - case encoder.OpStructFieldMarshalJSONPtr, encoder.OpStructFieldStringTagMarshalJSONPtr: + case encoder.OpStructFieldMarshalJSONPtr: p := load(ctxptr, code.HeadIdx) b = append(b, code.EscapedKey...) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3685,7 +3473,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldMarshalText, encoder.OpStructFieldStringTagMarshalText: + case encoder.OpStructFieldMarshalText: p := load(ctxptr, code.HeadIdx) b = append(b, code.EscapedKey...) p += code.Offset @@ -3720,7 +3508,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(bb) code = code.Next - case encoder.OpStructFieldMarshalTextPtr, encoder.OpStructFieldStringTagMarshalTextPtr: + case encoder.OpStructFieldMarshalTextPtr: p := load(ctxptr, code.HeadIdx) b = append(b, code.EscapedKey...) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3747,7 +3535,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldArray, encoder.OpStructFieldStringTagArray: + case encoder.OpStructFieldArray: b = append(b, code.EscapedKey...) p := load(ctxptr, code.HeadIdx) p += code.Offset @@ -3759,7 +3547,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = append(b, code.EscapedKey...) code = code.Next store(ctxptr, code.Idx, p) - case encoder.OpStructFieldArrayPtr, encoder.OpStructFieldStringTagArrayPtr: + case encoder.OpStructFieldArrayPtr: b = append(b, code.EscapedKey...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3775,7 +3563,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } else { code = code.NextField } - case encoder.OpStructFieldSlice, encoder.OpStructFieldStringTagSlice: + case encoder.OpStructFieldSlice: b = append(b, code.EscapedKey...) p := load(ctxptr, code.HeadIdx) p += code.Offset @@ -3792,7 +3580,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructFieldSlicePtr, encoder.OpStructFieldStringTagSlicePtr: + case encoder.OpStructFieldSlicePtr: b = append(b, code.EscapedKey...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3808,7 +3596,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } else { code = code.NextField } - case encoder.OpStructFieldMap, encoder.OpStructFieldStringTagMap: + case encoder.OpStructFieldMap: b = append(b, code.EscapedKey...) p := load(ctxptr, code.HeadIdx) p = ptrToPtr(p + code.Offset) @@ -3824,7 +3612,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructFieldMapPtr, encoder.OpStructFieldStringTagMapPtr: + case encoder.OpStructFieldMapPtr: b = append(b, code.EscapedKey...) p := load(ctxptr, code.HeadIdx) p = ptrToPtr(p + code.Offset) @@ -3887,7 +3675,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagInt: + case encoder.OpStructEndIntString: p := load(ctxptr, code.HeadIdx) b = append(b, code.EscapedKey...) b = append(b, '"') @@ -3923,7 +3711,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagIntPtr: + case encoder.OpStructEndIntPtrString: b = append(b, code.EscapedKey...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -3960,7 +3748,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagUint: + case encoder.OpStructEndUintString: p := load(ctxptr, code.HeadIdx) b = append(b, code.EscapedKey...) b = append(b, '"') @@ -3996,7 +3784,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagUintPtr: + case encoder.OpStructEndUintPtrString: b = append(b, code.EscapedKey...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -4032,7 +3820,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagFloat32: + case encoder.OpStructEndFloat32String: p := load(ctxptr, code.HeadIdx) b = append(b, code.EscapedKey...) b = append(b, '"') @@ -4068,7 +3856,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagFloat32Ptr: + case encoder.OpStructEndFloat32PtrString: b = append(b, code.EscapedKey...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -4111,7 +3899,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagFloat64: + case encoder.OpStructEndFloat64String: p := load(ctxptr, code.HeadIdx) v := ptrToFloat64(p + code.Offset) if math.IsInf(v, 0) || math.IsNaN(v) { @@ -4161,7 +3949,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagFloat64Ptr: + case encoder.OpStructEndFloat64PtrString: b = append(b, code.EscapedKey...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -4201,7 +3989,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagString: + case encoder.OpStructEndStringString: p := load(ctxptr, code.HeadIdx) b = append(b, code.EscapedKey...) s := ptrToString(p + code.Offset) @@ -4236,7 +4024,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagStringPtr: + case encoder.OpStructEndStringPtrString: b = append(b, code.EscapedKey...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -4271,7 +4059,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagBool: + case encoder.OpStructEndBoolString: p := load(ctxptr, code.HeadIdx) b = append(b, code.EscapedKey...) b = append(b, '"') @@ -4307,7 +4095,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagBoolPtr: + case encoder.OpStructEndBoolPtrString: b = append(b, code.EscapedKey...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) @@ -4343,13 +4131,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) - b = append(b, code.EscapedKey...) - b = appendByteSlice(b, v) - b = appendStructEnd(b) - code = code.Next case encoder.OpStructEndBytesPtr: b = append(b, code.EscapedKey...) p := load(ctxptr, code.HeadIdx) @@ -4378,17 +4159,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagBytesPtr: - b = append(b, code.EscapedKey...) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendStructEnd(b) - code = code.Next case encoder.OpStructEndNumber: p := load(ctxptr, code.HeadIdx) b = append(b, code.EscapedKey...) @@ -4418,7 +4188,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagNumber: + case encoder.OpStructEndNumberString: p := load(ctxptr, code.HeadIdx) b = append(b, code.EscapedKey...) b = append(b, '"') @@ -4464,7 +4234,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } code = code.Next - case encoder.OpStructEndStringTagNumberPtr: + case encoder.OpStructEndNumberPtrString: b = append(b, code.EscapedKey...) p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) diff --git a/internal/encoder/vm_escaped_indent/vm.go b/internal/encoder/vm_escaped_indent/vm.go index aee8f5f..f1a1915 100644 --- a/internal/encoder/vm_escaped_indent/vm.go +++ b/internal/encoder/vm_escaped_indent/vm.go @@ -655,37 +655,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadStringTag: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadStringTag: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{', '\n') - } - p += code.Offset - b = appendIndent(ctx, b, code.Indent+1) - b = append(b, code.EscapedKey...) - b = append(b, ' ') - code = code.Next - store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadInt: if code.Indirect { p := load(ctxptr, code.Idx) @@ -758,7 +727,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagInt: + case encoder.OpStructPtrHeadIntString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -772,7 +741,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagInt: + case encoder.OpStructHeadIntString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -866,7 +835,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagIntPtr: + case encoder.OpStructPtrHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -878,7 +847,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagIntPtr: + case encoder.OpStructHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -978,7 +947,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagUint: + case encoder.OpStructPtrHeadUintString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -992,7 +961,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagUint: + case encoder.OpStructHeadUintString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1086,7 +1055,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagUintPtr: + case encoder.OpStructPtrHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1098,7 +1067,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagUintPtr: + case encoder.OpStructHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1197,7 +1166,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagFloat32: + case encoder.OpStructPtrHeadFloat32String: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1211,7 +1180,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagFloat32: + case encoder.OpStructHeadFloat32String: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1305,7 +1274,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagFloat32Ptr: + case encoder.OpStructPtrHeadFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1317,7 +1286,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagFloat32Ptr: + case encoder.OpStructHeadFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1423,7 +1392,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagFloat64: + case encoder.OpStructPtrHeadFloat64String: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1437,7 +1406,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagFloat64: + case encoder.OpStructHeadFloat64String: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1543,7 +1512,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagFloat64Ptr: + case encoder.OpStructPtrHeadFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1555,7 +1524,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagFloat64Ptr: + case encoder.OpStructHeadFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1658,7 +1627,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagString: + case encoder.OpStructPtrHeadStringString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1672,7 +1641,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagString: + case encoder.OpStructHeadStringString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1766,7 +1735,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagStringPtr: + case encoder.OpStructPtrHeadStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1778,7 +1747,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagStringPtr: + case encoder.OpStructHeadStringPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1875,7 +1844,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } else { code = code.NextField } - case encoder.OpStructPtrHeadStringTagBool: + case encoder.OpStructPtrHeadBoolString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1889,7 +1858,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagBool: + case encoder.OpStructHeadBoolString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1983,7 +1952,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagBoolPtr: + case encoder.OpStructPtrHeadBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1995,7 +1964,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagBoolPtr: + case encoder.OpStructHeadBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2094,39 +2063,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagBytes: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadStringTagBytes: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{', '\n') - } - b = appendIndent(ctx, b, code.Indent+1) - b = append(b, code.EscapedKey...) - b = append(b, ' ') - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { @@ -2201,44 +2137,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadStringTagBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{', '\n') - } - b = appendIndent(ctx, b, code.Indent+1) - b = append(b, code.EscapedKey...) - b = append(b, ' ') - if code.Indirect { - p = ptrToPtr(p + code.Offset) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadNumber: if code.Indirect { p := load(ctxptr, code.Idx) @@ -2316,7 +2214,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) code = code.Next } - case encoder.OpStructPtrHeadStringTagNumber: + case encoder.OpStructPtrHeadNumberString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -2330,7 +2228,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagNumber: + case encoder.OpStructHeadNumberString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2435,7 +2333,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructPtrHeadStringTagNumberPtr: + case encoder.OpStructPtrHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2447,7 +2345,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagNumberPtr: + case encoder.OpStructHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2478,8 +2376,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadStringTagArray, - encoder.OpStructPtrHeadSlice, encoder.OpStructPtrHeadStringTagSlice: + case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -2493,8 +2390,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadArray, encoder.OpStructHeadStringTagArray, - encoder.OpStructHeadSlice, encoder.OpStructHeadStringTagSlice: + case encoder.OpStructHeadArray, encoder.OpStructHeadSlice: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2584,8 +2480,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadStringTagArrayPtr, - encoder.OpStructPtrHeadSlicePtr, encoder.OpStructPtrHeadStringTagSlicePtr: + case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2597,8 +2492,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadStringTagArrayPtr, - encoder.OpStructHeadSlicePtr, encoder.OpStructHeadStringTagSlicePtr: + case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2662,7 +2556,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadMap, encoder.OpStructPtrHeadStringTagMap: + case encoder.OpStructPtrHeadMap: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2674,7 +2568,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMap, encoder.OpStructHeadStringTagMap: + case encoder.OpStructHeadMap: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2732,7 +2626,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadMapPtr, encoder.OpStructPtrHeadStringTagMapPtr: + case encoder.OpStructPtrHeadMapPtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2744,7 +2638,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMapPtr, encoder.OpStructHeadStringTagMapPtr: + case encoder.OpStructHeadMapPtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2866,52 +2760,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructPtrHeadStringTagMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadStringTagMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{', '\n') - } - b = appendIndent(ctx, b, code.Indent+1) - b = append(b, code.EscapedKey...) - b = append(b, ' ') - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadStringTagMarshalJSON { - p = ptrToPtr(p + code.Offset) - } - } - if p == 0 && code.Nilcheck { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, true) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { @@ -2959,7 +2807,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadMarshalJSONPtr, encoder.OpStructPtrHeadStringTagMarshalJSONPtr: + case encoder.OpStructPtrHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2971,7 +2819,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMarshalJSONPtr, encoder.OpStructHeadStringTagMarshalJSONPtr: + case encoder.OpStructHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -3089,52 +2937,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructPtrHeadStringTagMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadStringTagMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{', '\n') - } - b = appendIndent(ctx, b, code.Indent+1) - b = append(b, code.EscapedKey...) - b = append(b, ' ') - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadStringTagMarshalText { - p = ptrToPtr(p + code.Offset) - } - } - if p == 0 && code.Nilcheck { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p), true) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) if p == 0 { @@ -3181,7 +2983,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadMarshalTextPtr, encoder.OpStructPtrHeadStringTagMarshalTextPtr: + case encoder.OpStructPtrHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -3193,7 +2995,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMarshalTextPtr, encoder.OpStructHeadStringTagMarshalTextPtr: + case encoder.OpStructHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -3286,14 +3088,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructFieldStringTag: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - b = appendIndent(ctx, b, code.Indent) - b = append(b, code.EscapedKey...) - b = append(b, ' ') - code = code.Next - store(ctxptr, code.Idx, p) case encoder.OpStructFieldInt: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) @@ -3314,7 +3108,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagInt: + case encoder.OpStructFieldIntString: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) @@ -3347,7 +3141,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagIntPtr: + case encoder.OpStructFieldIntPtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = appendIndent(ctx, b, code.Indent) @@ -3382,7 +3176,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagUint: + case encoder.OpStructFieldUintString: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) @@ -3415,7 +3209,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagUintPtr: + case encoder.OpStructFieldUintPtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = appendIndent(ctx, b, code.Indent) @@ -3449,7 +3243,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat32: + case encoder.OpStructFieldFloat32String: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) @@ -3482,7 +3276,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat32Ptr: + case encoder.OpStructFieldFloat32PtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = appendIndent(ctx, b, code.Indent) @@ -3523,7 +3317,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat64: + case encoder.OpStructFieldFloat64String: p := load(ctxptr, code.HeadIdx) v := ptrToFloat64(p + code.Offset) if math.IsInf(v, 0) || math.IsNaN(v) { @@ -3568,7 +3362,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat64Ptr: + case encoder.OpStructFieldFloat64PtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = appendIndent(ctx, b, code.Indent) @@ -3606,7 +3400,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagString: + case encoder.OpStructFieldStringString: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) @@ -3639,7 +3433,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagStringPtr: + case encoder.OpStructFieldStringPtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) b = append(b, ' ') @@ -3671,7 +3465,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBool: + case encoder.OpStructFieldBoolString: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) @@ -3704,7 +3498,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBoolPtr: + case encoder.OpStructFieldBoolPtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) b = append(b, ' ') @@ -3738,14 +3532,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBytes: - p := load(ctxptr, code.HeadIdx) - b = appendIndent(ctx, b, code.Indent) - b = append(b, code.EscapedKey...) - b = append(b, ' ') - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) - b = appendComma(b) - code = code.Next case encoder.OpStructFieldBytesPtr: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) @@ -3770,19 +3556,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBytesPtr: - b = appendIndent(ctx, b, code.Indent) - b = append(b, code.EscapedKey...) - b = append(b, ' ') - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendComma(b) - code = code.Next case encoder.OpStructFieldNumber: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) @@ -3808,7 +3581,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldStringTagNumber: + case encoder.OpStructFieldNumberString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) b = append(b, ' ') @@ -3852,7 +3625,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldStringTagNumberPtr: + case encoder.OpStructFieldNumberPtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) b = append(b, ' ') @@ -3870,7 +3643,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructFieldMarshalJSON, encoder.OpStructFieldStringTagMarshalJSON: + case encoder.OpStructFieldMarshalJSON: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) b = append(b, ' ') @@ -3914,7 +3687,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(bb) code = code.Next - case encoder.OpStructFieldMarshalJSONPtr, encoder.OpStructFieldStringTagMarshalJSONPtr: + case encoder.OpStructFieldMarshalJSONPtr: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) @@ -3945,7 +3718,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldMarshalText, encoder.OpStructFieldStringTagMarshalText: + case encoder.OpStructFieldMarshalText: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) @@ -3984,7 +3757,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(bb) code = code.Next - case encoder.OpStructFieldMarshalTextPtr, encoder.OpStructFieldStringTagMarshalTextPtr: + case encoder.OpStructFieldMarshalTextPtr: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) @@ -4015,7 +3788,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldArray, encoder.OpStructFieldStringTagArray: + case encoder.OpStructFieldArray: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) b = append(b, ' ') @@ -4031,7 +3804,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt p += code.Offset code = code.Next store(ctxptr, code.Idx, p) - case encoder.OpStructFieldArrayPtr, encoder.OpStructFieldStringTagArrayPtr: + case encoder.OpStructFieldArrayPtr: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) b = append(b, ' ') @@ -4051,7 +3824,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } else { code = code.NextField } - case encoder.OpStructFieldSlice, encoder.OpStructFieldStringTagSlice: + case encoder.OpStructFieldSlice: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) b = append(b, ' ') @@ -4072,7 +3845,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructFieldSlicePtr, encoder.OpStructFieldStringTagSlicePtr: + case encoder.OpStructFieldSlicePtr: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) b = append(b, ' ') @@ -4092,7 +3865,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } else { code = code.NextField } - case encoder.OpStructFieldMap, encoder.OpStructFieldStringTagMap: + case encoder.OpStructFieldMap: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) b = append(b, ' ') @@ -4112,7 +3885,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructFieldMapPtr, encoder.OpStructFieldStringTagMapPtr: + case encoder.OpStructFieldMapPtr: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) b = append(b, ' ') @@ -4138,7 +3911,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } else { code = code.NextField } - case encoder.OpStructFieldStruct, encoder.OpStructFieldStringTagStruct: + case encoder.OpStructFieldStruct: p := load(ctxptr, code.HeadIdx) p += code.Offset b = appendIndent(ctx, b, code.Indent) @@ -4211,7 +3984,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagInt: + case encoder.OpStructEndIntString: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) @@ -4258,7 +4031,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagIntPtr: + case encoder.OpStructEndIntPtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) b = append(b, ' ') @@ -4307,7 +4080,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagUint: + case encoder.OpStructEndUintString: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) @@ -4354,7 +4127,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagUintPtr: + case encoder.OpStructEndUintPtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) b = append(b, ' ') @@ -4402,7 +4175,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagFloat32: + case encoder.OpStructEndFloat32String: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) @@ -4449,7 +4222,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagFloat32Ptr: + case encoder.OpStructEndFloat32PtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) b = append(b, ' ') @@ -4504,7 +4277,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagFloat64: + case encoder.OpStructEndFloat64String: p := load(ctxptr, code.HeadIdx) v := ptrToFloat64(p + code.Offset) if math.IsInf(v, 0) || math.IsNaN(v) { @@ -4563,7 +4336,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagFloat64Ptr: + case encoder.OpStructEndFloat64PtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) b = append(b, ' ') @@ -4615,7 +4388,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagString: + case encoder.OpStructEndStringString: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) @@ -4662,7 +4435,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagStringPtr: + case encoder.OpStructEndStringPtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) b = append(b, ' ') @@ -4708,7 +4481,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagBool: + case encoder.OpStructEndBoolString: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) @@ -4755,7 +4528,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagBoolPtr: + case encoder.OpStructEndBoolPtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) b = append(b, ' ') @@ -4803,14 +4576,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagBytes: - p := load(ctxptr, code.HeadIdx) - b = appendIndent(ctx, b, code.Indent) - b = append(b, code.EscapedKey...) - b = append(b, ' ') - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) - b = appendStructEnd(ctx, b, code.Indent-1) - code = code.Next case encoder.OpStructEndBytesPtr: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) @@ -4849,19 +4614,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagBytesPtr: - b = appendIndent(ctx, b, code.Indent) - b = append(b, code.EscapedKey...) - b = append(b, ' ') - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendStructEnd(ctx, b, code.Indent-1) - code = code.Next case encoder.OpStructEndNumber: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) @@ -4901,7 +4653,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagNumber: + case encoder.OpStructEndNumberString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) b = append(b, ' ') @@ -4959,7 +4711,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagNumberPtr: + case encoder.OpStructEndNumberPtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.EscapedKey...) b = append(b, ' ') diff --git a/internal/encoder/vm_indent/vm.go b/internal/encoder/vm_indent/vm.go index fc27472..4aa83df 100644 --- a/internal/encoder/vm_indent/vm.go +++ b/internal/encoder/vm_indent/vm.go @@ -655,37 +655,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadStringTag: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadStringTag: - p := load(ctxptr, code.Idx) - if p == 0 && (code.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{', '\n') - } - p += code.Offset - b = appendIndent(ctx, b, code.Indent+1) - b = append(b, code.Key...) - b = append(b, ' ') - code = code.Next - store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadInt: if code.Indirect { p := load(ctxptr, code.Idx) @@ -758,7 +727,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagInt: + case encoder.OpStructPtrHeadIntString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -772,7 +741,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagInt: + case encoder.OpStructHeadIntString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -866,7 +835,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagIntPtr: + case encoder.OpStructPtrHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -878,7 +847,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagIntPtr: + case encoder.OpStructHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -978,7 +947,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagUint: + case encoder.OpStructPtrHeadUintString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -992,7 +961,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagUint: + case encoder.OpStructHeadUintString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1086,7 +1055,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagUintPtr: + case encoder.OpStructPtrHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1098,7 +1067,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagUintPtr: + case encoder.OpStructHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1197,7 +1166,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagFloat32: + case encoder.OpStructPtrHeadFloat32String: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1211,7 +1180,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagFloat32: + case encoder.OpStructHeadFloat32String: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1305,7 +1274,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagFloat32Ptr: + case encoder.OpStructPtrHeadFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1317,7 +1286,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagFloat32Ptr: + case encoder.OpStructHeadFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1423,7 +1392,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagFloat64: + case encoder.OpStructPtrHeadFloat64String: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1437,7 +1406,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagFloat64: + case encoder.OpStructHeadFloat64String: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1543,7 +1512,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagFloat64Ptr: + case encoder.OpStructPtrHeadFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1555,7 +1524,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagFloat64Ptr: + case encoder.OpStructHeadFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1658,7 +1627,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagString: + case encoder.OpStructPtrHeadStringString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1672,7 +1641,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagString: + case encoder.OpStructHeadStringString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1766,7 +1735,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagStringPtr: + case encoder.OpStructPtrHeadStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1778,7 +1747,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagStringPtr: + case encoder.OpStructHeadStringPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -1875,7 +1844,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } else { code = code.NextField } - case encoder.OpStructPtrHeadStringTagBool: + case encoder.OpStructPtrHeadBoolString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -1889,7 +1858,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagBool: + case encoder.OpStructHeadBoolString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1983,7 +1952,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagBoolPtr: + case encoder.OpStructPtrHeadBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -1995,7 +1964,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagBoolPtr: + case encoder.OpStructHeadBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2094,39 +2063,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadStringTagBytes: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadStringTagBytes: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{', '\n') - } - b = appendIndent(ctx, b, code.Indent+1) - b = append(b, code.Key...) - b = append(b, ' ') - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { @@ -2201,44 +2137,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructPtrHeadStringTagBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - fallthrough - case encoder.OpStructHeadStringTagBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{', '\n') - } - b = appendIndent(ctx, b, code.Indent+1) - b = append(b, code.Key...) - b = append(b, ' ') - if code.Indirect { - p = ptrToPtr(p + code.Offset) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadNumber: if code.Indirect { p := load(ctxptr, code.Idx) @@ -2316,7 +2214,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) code = code.Next } - case encoder.OpStructPtrHeadStringTagNumber: + case encoder.OpStructPtrHeadNumberString: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -2330,7 +2228,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadStringTagNumber: + case encoder.OpStructHeadNumberString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2435,7 +2333,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructPtrHeadStringTagNumberPtr: + case encoder.OpStructPtrHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2447,7 +2345,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadStringTagNumberPtr: + case encoder.OpStructHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2478,8 +2376,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadStringTagArray, - encoder.OpStructPtrHeadSlice, encoder.OpStructPtrHeadStringTagSlice: + case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: if code.Indirect { p := load(ctxptr, code.Idx) if p == 0 { @@ -2493,8 +2390,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) } fallthrough - case encoder.OpStructHeadArray, encoder.OpStructHeadStringTagArray, - encoder.OpStructHeadSlice, encoder.OpStructHeadStringTagSlice: + case encoder.OpStructHeadArray, encoder.OpStructHeadSlice: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2584,8 +2480,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadStringTagArrayPtr, - encoder.OpStructPtrHeadSlicePtr, encoder.OpStructPtrHeadStringTagSlicePtr: + case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2597,8 +2492,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadStringTagArrayPtr, - encoder.OpStructHeadSlicePtr, encoder.OpStructHeadStringTagSlicePtr: + case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2662,7 +2556,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadMap, encoder.OpStructPtrHeadStringTagMap: + case encoder.OpStructPtrHeadMap: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2674,7 +2568,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMap, encoder.OpStructHeadStringTagMap: + case encoder.OpStructHeadMap: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2732,7 +2626,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructPtrHeadMapPtr, encoder.OpStructPtrHeadStringTagMapPtr: + case encoder.OpStructPtrHeadMapPtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2744,7 +2638,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMapPtr, encoder.OpStructHeadStringTagMapPtr: + case encoder.OpStructHeadMapPtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -2866,52 +2760,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructPtrHeadStringTagMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadStringTagMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{', '\n') - } - b = appendIndent(ctx, b, code.Indent+1) - b = append(b, code.Key...) - b = append(b, ' ') - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadStringTagMarshalJSON { - p = ptrToPtr(p + code.Offset) - } - } - if p == 0 && code.Nilcheck { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p), code.Indent+1, false) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { @@ -2959,7 +2807,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadMarshalJSONPtr, encoder.OpStructPtrHeadStringTagMarshalJSONPtr: + case encoder.OpStructPtrHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -2971,7 +2819,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMarshalJSONPtr, encoder.OpStructHeadStringTagMarshalJSONPtr: + case encoder.OpStructHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -3089,52 +2937,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructPtrHeadStringTagMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadStringTagMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = append(b, '{', '\n') - } - b = appendIndent(ctx, b, code.Indent+1) - b = append(b, code.Key...) - b = append(b, ' ') - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadStringTagMarshalText { - p = ptrToPtr(p + code.Offset) - } - } - if p == 0 && code.Nilcheck { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p), false) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) if p == 0 { @@ -3181,7 +2983,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) code = code.Next } - case encoder.OpStructPtrHeadMarshalTextPtr, encoder.OpStructPtrHeadStringTagMarshalTextPtr: + case encoder.OpStructPtrHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { if !code.AnonymousHead { @@ -3193,7 +2995,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) fallthrough - case encoder.OpStructHeadMarshalTextPtr, encoder.OpStructHeadStringTagMarshalTextPtr: + case encoder.OpStructHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 && code.Indirect { if !code.AnonymousHead { @@ -3286,14 +3088,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructFieldStringTag: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - b = appendIndent(ctx, b, code.Indent) - b = append(b, code.Key...) - b = append(b, ' ') - code = code.Next - store(ctxptr, code.Idx, p) case encoder.OpStructFieldInt: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) @@ -3314,7 +3108,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagInt: + case encoder.OpStructFieldIntString: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) @@ -3347,7 +3141,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagIntPtr: + case encoder.OpStructFieldIntPtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = appendIndent(ctx, b, code.Indent) @@ -3382,7 +3176,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagUint: + case encoder.OpStructFieldUintString: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) @@ -3415,7 +3209,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagUintPtr: + case encoder.OpStructFieldUintPtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = appendIndent(ctx, b, code.Indent) @@ -3449,7 +3243,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat32: + case encoder.OpStructFieldFloat32String: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) @@ -3482,7 +3276,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat32Ptr: + case encoder.OpStructFieldFloat32PtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = appendIndent(ctx, b, code.Indent) @@ -3523,7 +3317,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat64: + case encoder.OpStructFieldFloat64String: p := load(ctxptr, code.HeadIdx) v := ptrToFloat64(p + code.Offset) if math.IsInf(v, 0) || math.IsNaN(v) { @@ -3568,7 +3362,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagFloat64Ptr: + case encoder.OpStructFieldFloat64PtrString: p := load(ctxptr, code.HeadIdx) p = ptrToNPtr(p+code.Offset, code.PtrNum) b = appendIndent(ctx, b, code.Indent) @@ -3606,7 +3400,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagString: + case encoder.OpStructFieldStringString: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) @@ -3639,7 +3433,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagStringPtr: + case encoder.OpStructFieldStringPtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) b = append(b, ' ') @@ -3671,7 +3465,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBool: + case encoder.OpStructFieldBoolString: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) @@ -3704,7 +3498,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBoolPtr: + case encoder.OpStructFieldBoolPtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) b = append(b, ' ') @@ -3738,14 +3532,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBytes: - p := load(ctxptr, code.HeadIdx) - b = appendIndent(ctx, b, code.Indent) - b = append(b, code.Key...) - b = append(b, ' ') - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) - b = appendComma(b) - code = code.Next case encoder.OpStructFieldBytesPtr: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) @@ -3770,19 +3556,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructFieldStringTagBytesPtr: - b = appendIndent(ctx, b, code.Indent) - b = append(b, code.Key...) - b = append(b, ' ') - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendComma(b) - code = code.Next case encoder.OpStructFieldNumber: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) @@ -3808,7 +3581,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldStringTagNumber: + case encoder.OpStructFieldNumberString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) b = append(b, ' ') @@ -3852,7 +3625,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldStringTagNumberPtr: + case encoder.OpStructFieldNumberPtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) b = append(b, ' ') @@ -3870,7 +3643,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(b) code = code.Next - case encoder.OpStructFieldMarshalJSON, encoder.OpStructFieldStringTagMarshalJSON: + case encoder.OpStructFieldMarshalJSON: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) b = append(b, ' ') @@ -3914,7 +3687,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(bb) code = code.Next - case encoder.OpStructFieldMarshalJSONPtr, encoder.OpStructFieldStringTagMarshalJSONPtr: + case encoder.OpStructFieldMarshalJSONPtr: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) @@ -3945,7 +3718,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldMarshalText, encoder.OpStructFieldStringTagMarshalText: + case encoder.OpStructFieldMarshalText: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) @@ -3984,7 +3757,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendComma(bb) code = code.Next - case encoder.OpStructFieldMarshalTextPtr, encoder.OpStructFieldStringTagMarshalTextPtr: + case encoder.OpStructFieldMarshalTextPtr: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) @@ -4015,7 +3788,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(bb) } code = code.Next - case encoder.OpStructFieldArray, encoder.OpStructFieldStringTagArray: + case encoder.OpStructFieldArray: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) b = append(b, ' ') @@ -4031,7 +3804,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt p += code.Offset code = code.Next store(ctxptr, code.Idx, p) - case encoder.OpStructFieldArrayPtr, encoder.OpStructFieldStringTagArrayPtr: + case encoder.OpStructFieldArrayPtr: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) b = append(b, ' ') @@ -4051,7 +3824,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } else { code = code.NextField } - case encoder.OpStructFieldSlice, encoder.OpStructFieldStringTagSlice: + case encoder.OpStructFieldSlice: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) b = append(b, ' ') @@ -4072,7 +3845,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructFieldSlicePtr, encoder.OpStructFieldStringTagSlicePtr: + case encoder.OpStructFieldSlicePtr: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) b = append(b, ' ') @@ -4092,7 +3865,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } else { code = code.NextField } - case encoder.OpStructFieldMap, encoder.OpStructFieldStringTagMap: + case encoder.OpStructFieldMap: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) b = append(b, ' ') @@ -4112,7 +3885,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } - case encoder.OpStructFieldMapPtr, encoder.OpStructFieldStringTagMapPtr: + case encoder.OpStructFieldMapPtr: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) b = append(b, ' ') @@ -4138,7 +3911,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } else { code = code.NextField } - case encoder.OpStructFieldStruct, encoder.OpStructFieldStringTagStruct: + case encoder.OpStructFieldStruct: p := load(ctxptr, code.HeadIdx) p += code.Offset b = appendIndent(ctx, b, code.Indent) @@ -4211,7 +3984,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagInt: + case encoder.OpStructEndIntString: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) @@ -4258,7 +4031,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagIntPtr: + case encoder.OpStructEndIntPtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) b = append(b, ' ') @@ -4307,7 +4080,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagUint: + case encoder.OpStructEndUintString: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) @@ -4354,7 +4127,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagUintPtr: + case encoder.OpStructEndUintPtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) b = append(b, ' ') @@ -4402,7 +4175,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagFloat32: + case encoder.OpStructEndFloat32String: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) @@ -4449,7 +4222,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagFloat32Ptr: + case encoder.OpStructEndFloat32PtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) b = append(b, ' ') @@ -4504,7 +4277,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagFloat64: + case encoder.OpStructEndFloat64String: p := load(ctxptr, code.HeadIdx) v := ptrToFloat64(p + code.Offset) if math.IsInf(v, 0) || math.IsNaN(v) { @@ -4563,7 +4336,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagFloat64Ptr: + case encoder.OpStructEndFloat64PtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) b = append(b, ' ') @@ -4615,7 +4388,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagString: + case encoder.OpStructEndStringString: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) @@ -4662,7 +4435,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagStringPtr: + case encoder.OpStructEndStringPtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) b = append(b, ' ') @@ -4708,7 +4481,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagBool: + case encoder.OpStructEndBoolString: p := load(ctxptr, code.HeadIdx) b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) @@ -4755,7 +4528,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagBoolPtr: + case encoder.OpStructEndBoolPtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) b = append(b, ' ') @@ -4803,14 +4576,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagBytes: - p := load(ctxptr, code.HeadIdx) - b = appendIndent(ctx, b, code.Indent) - b = append(b, code.Key...) - b = append(b, ' ') - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) - b = appendStructEnd(ctx, b, code.Indent-1) - code = code.Next case encoder.OpStructEndBytesPtr: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) @@ -4849,19 +4614,6 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagBytesPtr: - b = appendIndent(ctx, b, code.Indent) - b = append(b, code.Key...) - b = append(b, ' ') - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendStructEnd(ctx, b, code.Indent-1) - code = code.Next case encoder.OpStructEndNumber: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) @@ -4901,7 +4653,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagNumber: + case encoder.OpStructEndNumberString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) b = append(b, ' ') @@ -4959,7 +4711,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendComma(b) } code = code.Next - case encoder.OpStructEndStringTagNumberPtr: + case encoder.OpStructEndNumberPtrString: b = appendIndent(ctx, b, code.Indent) b = append(b, code.Key...) b = append(b, ' ') diff --git a/internal/runtime/struct_field.go b/internal/runtime/struct_field.go index 7700eb2..c321180 100644 --- a/internal/runtime/struct_field.go +++ b/internal/runtime/struct_field.go @@ -74,8 +74,14 @@ func StructTagFromField(field reflect.StructField) *StructTag { } st.Key = keyName if len(opts) > 1 { - st.IsOmitEmpty = opts[1] == "omitempty" - st.IsString = opts[1] == "string" + for _, opt := range opts[1:] { + switch opt { + case "omitempty": + st.IsOmitEmpty = true + case "string": + st.IsString = true + } + } } return st }