Merge pull request #86 from goccy/feature/add-test

Add test cases for int8 type
This commit is contained in:
Masaaki Goshima 2021-01-17 03:42:36 +09:00 committed by GitHub
commit b9480a6449
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 3611 additions and 512 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1124,6 +1124,51 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
v := e.ptrToInt8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadInt8Only, opStructFieldHeadInt8Only:
p := load(ctxptr, code.idx)
b = append(b, '{')
@ -1131,6 +1176,25 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = appendInt(b, int64(e.ptrToInt8(p)))
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt8Only, opStructFieldHeadOmitEmptyInt8Only:
p := load(ctxptr, code.idx)
b = append(b, '{')
v := int64(e.ptrToInt8(p))
if v != 0 {
b = append(b, code.key...)
b = appendInt(b, v)
b = encodeComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt8Only, opStructFieldHeadStringTagInt8Only:
p := load(ctxptr, code.idx)
b = append(b, '{')
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -1153,6 +1217,49 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadOmitEmptyInt8Ptr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
p = e.ptrToPtr(p)
if p != 0 {
b = append(b, code.key...)
b = appendInt(b, int64(e.ptrToInt8(p)))
b = encodeComma(b)
}
code = code.next
}
case opStructFieldPtrHeadStringTagInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadStringTagInt8Ptr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
break
} else {
b = append(b, '{')
b = append(b, code.key...)
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = append(b, '"')
}
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -1174,6 +1281,69 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldHeadOmitEmptyInt8PtrOnly:
b = append(b, '{')
p := load(ctxptr, code.idx)
if p != 0 {
b = append(b, code.key...)
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = encodeComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldHeadStringTagInt8PtrOnly:
p := load(ctxptr, code.idx)
b = append(b, '{')
b = append(b, code.key...)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = append(b, '"')
}
b = encodeComma(b)
code = code.next
case opStructFieldHeadInt8NPtr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '{')
b = append(b, code.key...)
for i := 0; i < code.ptrNum; i++ {
if p == 0 {
break
}
p = e.ptrToPtr(p)
}
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
}
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadInt8:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -1187,6 +1357,45 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt8Only, opStructFieldAnonymousHeadInt8Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
@ -1197,6 +1406,33 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt8Only, opStructFieldAnonymousHeadOmitEmptyInt8Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt8Only, opStructFieldAnonymousHeadStringTagInt8Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -1215,6 +1451,44 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt8Ptr:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
p = e.ptrToPtr(p)
if p == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = appendInt(b, int64(e.ptrToInt8(p)))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagInt8Ptr:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
b = append(b, code.key...)
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = append(b, '"')
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -1233,6 +1507,44 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadStringTagInt8PtrOnly:
p := load(ctxptr, code.idx)
b = append(b, code.key...)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = append(b, '"')
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadInt16:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2981,51 +3293,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
v := e.ptrToInt8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.key...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrHeadOmitEmptyInt16:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -3809,45 +4076,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
code = code.next
store(ctxptr, code.idx, ptr+code.offset)
}
case opStructFieldPtrHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadStringTagInt16:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -4506,6 +4734,29 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
ptr := load(ctxptr, code.headIdx) + code.offset
code = code.next
store(ctxptr, code.idx, ptr)
case opStructFieldInt:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.key...)
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = encodeComma(b)
code = code.next
case opStructFieldOmitEmptyInt:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt(ptr + code.offset)
if v != 0 {
b = append(b, code.key...)
b = appendInt(b, int64(v))
b = encodeComma(b)
}
code = code.next
case opStructFieldStringTagInt:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
case opStructFieldIntPtr:
b = append(b, code.key...)
ptr := load(ctxptr, code.headIdx)
@ -4534,10 +4785,27 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = encodeComma(b)
code = code.next
case opStructFieldInt:
case opStructFieldInt8:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.key...)
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = encodeComma(b)
code = code.next
case opStructFieldOmitEmptyInt8:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt8(ptr + code.offset)
if v != 0 {
b = append(b, code.key...)
b = appendInt(b, int64(v))
b = encodeComma(b)
}
code = code.next
case opStructFieldStringTagInt8:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
case opStructFieldInt8Ptr:
@ -4551,12 +4819,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = encodeComma(b)
code = code.next
case opStructFieldInt8:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.key...)
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = encodeComma(b)
code = code.next
case opStructFieldInt16Ptr:
b = append(b, code.key...)
ptr := load(ctxptr, code.headIdx)
@ -4845,24 +5107,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
code = code.next
store(ctxptr, code.idx, p)
}
case opStructFieldOmitEmptyInt:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt(ptr + code.offset)
if v != 0 {
b = append(b, code.key...)
b = appendInt(b, int64(v))
b = encodeComma(b)
}
code = code.next
case opStructFieldOmitEmptyInt8:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt8(ptr + code.offset)
if v != 0 {
b = append(b, code.key...)
b = appendInt(b, int64(v))
b = encodeComma(b)
}
code = code.next
case opStructFieldOmitEmptyInt16:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt16(ptr + code.offset)
@ -5065,22 +5309,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = append(b, code.key...)
code = code.next
store(ctxptr, code.idx, p)
case opStructFieldStringTagInt:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
case opStructFieldStringTagInt8:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
case opStructFieldStringTagInt16:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.key...)
@ -5299,6 +5527,29 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = appendStructEnd(b)
code = code.next
case opStructEndInt8:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.key...)
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = appendStructEnd(b)
code = code.next
case opStructEndOmitEmptyInt8:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt8(ptr + code.offset)
if v != 0 {
b = append(b, code.key...)
b = appendInt(b, int64(v))
}
b = appendStructEnd(b)
code = code.next
case opStructEndStringTagInt8:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = appendStructEnd(b)
code = code.next
case opStructEndInt8Ptr:
b = append(b, code.key...)
ptr := load(ctxptr, code.headIdx)
@ -5310,10 +5561,43 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = appendStructEnd(b)
code = code.next
case opStructEndInt8:
case opStructEndOmitEmptyInt8Ptr:
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p != 0 {
b = append(b, code.key...)
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = appendInt(b, int64(e.ptrToInt8(p)))
}
b = appendStructEnd(b)
code = code.next
case opStructEndStringTagInt8Ptr:
b = append(b, code.key...)
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p)))
b = append(b, '"')
}
b = appendStructEnd(b)
code = code.next
case opStructEndInt8NPtr:
b = append(b, code.key...)
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
for i := 0; i < code.ptrNum-1; i++ {
if p == 0 {
break
}
p = e.ptrToPtr(p)
}
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt8(p)))
}
b = appendStructEnd(b)
code = code.next
case opStructEndInt16Ptr:
@ -5564,15 +5848,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
b = encodeNoEscapedString(b, *(*string)(unsafe.Pointer(&bytes)))
b = appendStructEnd(b)
code = code.next
case opStructEndOmitEmptyInt8:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt8(ptr + code.offset)
if v != 0 {
b = append(b, code.key...)
b = appendInt(b, int64(v))
}
b = appendStructEnd(b)
code = code.next
case opStructEndOmitEmptyInt16:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt16(ptr + code.offset)
@ -5725,14 +6000,6 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, b []byte, code *opcode) ([]byte
}
b = appendStructEnd(b)
code = code.next
case opStructEndStringTagInt8:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.key...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = appendStructEnd(b)
code = code.next
case opStructEndStringTagInt16:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.key...)

View File

@ -1084,6 +1084,51 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
v := e.ptrToInt8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadInt8Only, opStructFieldHeadInt8Only:
p := load(ctxptr, code.idx)
b = append(b, '{')
@ -1091,6 +1136,25 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = appendInt(b, int64(e.ptrToInt8(p)))
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt8Only, opStructFieldHeadOmitEmptyInt8Only:
p := load(ctxptr, code.idx)
b = append(b, '{')
v := int64(e.ptrToInt8(p))
if v != 0 {
b = append(b, code.escapedKey...)
b = appendInt(b, v)
b = encodeComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt8Only, opStructFieldHeadStringTagInt8Only:
p := load(ctxptr, code.idx)
b = append(b, '{')
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -1113,6 +1177,49 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadOmitEmptyInt8Ptr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
p = e.ptrToPtr(p)
if p != 0 {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(e.ptrToInt8(p)))
b = encodeComma(b)
}
code = code.next
}
case opStructFieldPtrHeadStringTagInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadStringTagInt8Ptr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
break
} else {
b = append(b, '{')
b = append(b, code.escapedKey...)
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = append(b, '"')
}
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -1134,6 +1241,69 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldHeadOmitEmptyInt8PtrOnly:
b = append(b, '{')
p := load(ctxptr, code.idx)
if p != 0 {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = encodeComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldHeadStringTagInt8PtrOnly:
p := load(ctxptr, code.idx)
b = append(b, '{')
b = append(b, code.escapedKey...)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = append(b, '"')
}
b = encodeComma(b)
code = code.next
case opStructFieldHeadInt8NPtr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '{')
b = append(b, code.escapedKey...)
for i := 0; i < code.ptrNum; i++ {
if p == 0 {
break
}
p = e.ptrToPtr(p)
}
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
}
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadInt8:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -1147,6 +1317,45 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt8Only, opStructFieldAnonymousHeadInt8Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
@ -1157,6 +1366,33 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt8Only, opStructFieldAnonymousHeadOmitEmptyInt8Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt8Only, opStructFieldAnonymousHeadStringTagInt8Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -1175,6 +1411,44 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt8Ptr:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
p = e.ptrToPtr(p)
if p == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(e.ptrToInt8(p)))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagInt8Ptr:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
b = append(b, code.escapedKey...)
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = append(b, '"')
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -1193,6 +1467,44 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadStringTagInt8PtrOnly:
p := load(ctxptr, code.idx)
b = append(b, code.escapedKey...)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = append(b, '"')
}
b = encodeComma(b)
code = code.next
case opStructFieldPtrHeadInt16:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -2948,51 +3260,6 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
v := e.ptrToInt8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(v))
b = encodeComma(b)
code = code.next
}
}
case opStructFieldPtrHeadOmitEmptyInt16:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -3776,45 +4043,6 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
code = code.next
store(ctxptr, code.idx, ptr+code.offset)
}
case opStructFieldPtrHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeComma(b)
code = code.end.next
} else {
b = append(b, '{')
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldAnonymousHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
}
case opStructFieldPtrHeadStringTagInt16:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -4532,6 +4760,29 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
ptr := load(ctxptr, code.headIdx) + code.offset
code = code.next
store(ctxptr, code.idx, ptr)
case opStructFieldInt:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.escapedKey...)
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = encodeComma(b)
code = code.next
case opStructFieldOmitEmptyInt:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt(ptr + code.offset)
if v != 0 {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(v))
b = encodeComma(b)
}
code = code.next
case opStructFieldStringTagInt:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
case opStructFieldIntPtr:
b = append(b, code.escapedKey...)
ptr := load(ctxptr, code.headIdx)
@ -4560,10 +4811,27 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = encodeComma(b)
code = code.next
case opStructFieldInt:
case opStructFieldInt8:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.escapedKey...)
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = encodeComma(b)
code = code.next
case opStructFieldOmitEmptyInt8:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt8(ptr + code.offset)
if v != 0 {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(v))
b = encodeComma(b)
}
code = code.next
case opStructFieldStringTagInt8:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
case opStructFieldInt8Ptr:
@ -4577,12 +4845,6 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = encodeComma(b)
code = code.next
case opStructFieldInt8:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.escapedKey...)
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = encodeComma(b)
code = code.next
case opStructFieldInt16Ptr:
b = append(b, code.escapedKey...)
ptr := load(ctxptr, code.headIdx)
@ -4871,24 +5133,6 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
code = code.next
store(ctxptr, code.idx, p)
}
case opStructFieldOmitEmptyInt:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt(ptr + code.offset)
if v != 0 {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(v))
b = encodeComma(b)
}
code = code.next
case opStructFieldOmitEmptyInt8:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt8(ptr + code.offset)
if v != 0 {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(v))
b = encodeComma(b)
}
code = code.next
case opStructFieldOmitEmptyInt16:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt16(ptr + code.offset)
@ -5091,22 +5335,6 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = append(b, code.escapedKey...)
code = code.next
store(ctxptr, code.idx, p)
case opStructFieldStringTagInt:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
case opStructFieldStringTagInt8:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeComma(b)
code = code.next
case opStructFieldStringTagInt16:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.escapedKey...)
@ -5325,6 +5553,29 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = appendStructEnd(b)
code = code.next
case opStructEndInt8:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.escapedKey...)
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = appendStructEnd(b)
code = code.next
case opStructEndOmitEmptyInt8:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt8(ptr + code.offset)
if v != 0 {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(v))
}
b = appendStructEnd(b)
code = code.next
case opStructEndStringTagInt8:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = appendStructEnd(b)
code = code.next
case opStructEndInt8Ptr:
b = append(b, code.escapedKey...)
ptr := load(ctxptr, code.headIdx)
@ -5336,10 +5587,43 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = appendStructEnd(b)
code = code.next
case opStructEndInt8:
case opStructEndOmitEmptyInt8Ptr:
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p != 0 {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = appendInt(b, int64(e.ptrToInt8(p)))
}
b = appendStructEnd(b)
code = code.next
case opStructEndStringTagInt8Ptr:
b = append(b, code.escapedKey...)
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p)))
b = append(b, '"')
}
b = appendStructEnd(b)
code = code.next
case opStructEndInt8NPtr:
b = append(b, code.escapedKey...)
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
for i := 0; i < code.ptrNum-1; i++ {
if p == 0 {
break
}
p = e.ptrToPtr(p)
}
if p == 0 {
b = encodeNull(b)
} else {
b = appendInt(b, int64(e.ptrToInt8(p)))
}
b = appendStructEnd(b)
code = code.next
case opStructEndInt16Ptr:
@ -5590,15 +5874,6 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
b = encodeEscapedString(b, *(*string)(unsafe.Pointer(&bytes)))
b = appendStructEnd(b)
code = code.next
case opStructEndOmitEmptyInt8:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt8(ptr + code.offset)
if v != 0 {
b = append(b, code.escapedKey...)
b = appendInt(b, int64(v))
}
b = appendStructEnd(b)
code = code.next
case opStructEndOmitEmptyInt16:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt16(ptr + code.offset)
@ -5751,14 +6026,6 @@ func (e *Encoder) runEscaped(ctx *encodeRuntimeContext, b []byte, code *opcode)
}
b = appendStructEnd(b)
code = code.next
case opStructEndStringTagInt8:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.escapedKey...)
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = appendStructEnd(b)
code = code.next
case opStructEndStringTagInt16:
ptr := load(ctxptr, code.headIdx)
b = append(b, code.escapedKey...)

View File

@ -1165,6 +1165,54 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
v := e.ptrToInt8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadInt8Only, opStructFieldHeadInt8Only:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
@ -1174,6 +1222,28 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = appendInt(b, int64(e.ptrToInt8(p)))
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt8Only, opStructFieldHeadOmitEmptyInt8Only:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
v := int64(e.ptrToInt8(p))
if v != 0 {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, v)
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt8Only, opStructFieldHeadStringTagInt8Only:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt8(p)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -1198,6 +1268,53 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadOmitEmptyInt8Ptr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
p = e.ptrToPtr(p)
if p != 0 {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt8(p)))
b = encodeIndentComma(b)
}
code = code.next
}
case opStructFieldPtrHeadStringTagInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadStringTagInt8Ptr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = append(b, '"')
}
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -1221,6 +1338,52 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldHeadOmitEmptyInt8PtrOnly:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
if p != 0 {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldHeadStringTagInt8PtrOnly:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = append(b, '"')
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldHeadInt8NPtr:
p := load(ctxptr, code.idx)
if p == 0 {
@ -1259,6 +1422,43 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt8:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt8:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt8Only, opStructFieldAnonymousHeadInt8Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
@ -1271,6 +1471,37 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt8Only, opStructFieldAnonymousHeadOmitEmptyInt8Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt8Only, opStructFieldAnonymousHeadStringTagInt8Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -1291,6 +1522,48 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt8Ptr:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
p = e.ptrToPtr(p)
if p == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt8(p)))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagInt8Ptr:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = append(b, '"')
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -1311,6 +1584,48 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadStringTagInt8PtrOnly:
p := load(ctxptr, code.idx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = append(b, '"')
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadInt16:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -3047,34 +3362,6 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToInt8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrHeadOmitEmptyInt16:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -3463,29 +3750,6 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
code = code.next
store(ctxptr, code.idx, p)
}
case opStructFieldPtrHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadStringTagInt16:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -3804,6 +4068,26 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
case opStructFieldOmitEmptyInt:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldStringTagInt:
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
case opStructFieldInt8:
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
@ -3812,6 +4096,26 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
case opStructFieldOmitEmptyInt8:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt8(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldStringTagInt8:
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
case opStructFieldInt16:
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
@ -4037,28 +4341,6 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
code = code.next
store(ctxptr, code.idx, p)
}
case opStructFieldOmitEmptyInt:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldOmitEmptyInt8:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt8(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldOmitEmptyInt16:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt16(ptr + code.offset)
@ -4288,24 +4570,6 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = append(b, ' ')
code = code.next
store(ctxptr, code.idx, p)
case opStructFieldStringTagInt:
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
case opStructFieldStringTagInt8:
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
case opStructFieldStringTagInt16:
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
@ -4570,6 +4834,35 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndOmitEmptyInt8:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt8(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = e.appendStructEndIndent(b, code.indent-1)
} else {
last := len(b) - 1
if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}'
} else {
b = append(b, '}')
}
b = encodeIndentComma(b)
}
code = code.next
case opStructEndStringTagInt8:
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndInt8Ptr:
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
@ -4583,6 +4876,41 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndOmitEmptyInt8Ptr:
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt8(p)))
b = e.appendStructEndIndent(b, code.indent-1)
} else {
last := len(b) - 1
if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}'
} else {
b = append(b, '}')
}
b = encodeIndentComma(b)
}
code = code.next
case opStructEndStringTagInt8Ptr:
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p)))
b = append(b, '"')
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndInt16:
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
@ -4843,17 +5171,6 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
b = append(b, buf.Bytes()...)
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndOmitEmptyInt8:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt8(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = appendInt(b, int64(v))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndOmitEmptyInt16:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt16(ptr + code.offset)
@ -5000,15 +5317,6 @@ func (e *Encoder) runEscapedIndent(ctx *encodeRuntimeContext, b []byte, code *op
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndStringTagInt8:
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndStringTagInt16:
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)

View File

@ -1165,6 +1165,54 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
v := e.ptrToInt8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadInt8Only, opStructFieldHeadInt8Only:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
@ -1174,6 +1222,28 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = appendInt(b, int64(e.ptrToInt8(p)))
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt8Only, opStructFieldHeadOmitEmptyInt8Only:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
v := int64(e.ptrToInt8(p))
if v != 0 {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, v)
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt8Only, opStructFieldHeadStringTagInt8Only:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt8(p)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -1198,6 +1268,53 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadOmitEmptyInt8Ptr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
p = e.ptrToPtr(p)
if p != 0 {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt8(p)))
b = encodeIndentComma(b)
}
code = code.next
}
case opStructFieldPtrHeadStringTagInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldHeadStringTagInt8Ptr:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = append(b, '"')
}
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -1221,6 +1338,52 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadOmitEmptyInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldHeadOmitEmptyInt8PtrOnly:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
if p != 0 {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldPtrHeadStringTagInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldHeadStringTagInt8PtrOnly:
p := load(ctxptr, code.idx)
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = append(b, '"')
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldHeadInt8NPtr:
p := load(ctxptr, code.idx)
if p == 0 {
@ -1259,6 +1422,43 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt8:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt8:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.escapedKey...)
b = append(b, ' ')
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt8Only, opStructFieldAnonymousHeadInt8Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
@ -1271,6 +1471,37 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadOmitEmptyInt8Only, opStructFieldAnonymousHeadOmitEmptyInt8Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
v := e.ptrToInt8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrAnonymousHeadStringTagInt8Only, opStructFieldAnonymousHeadStringTagInt8Only:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -1291,6 +1522,48 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt8Ptr:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
p = e.ptrToPtr(p)
if p == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt8(p)))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt8Ptr:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
case opStructFieldAnonymousHeadStringTagInt8Ptr:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
p = e.ptrToPtr(p)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = append(b, '"')
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
@ -1311,6 +1584,48 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrAnonymousHeadOmitEmptyInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadOmitEmptyInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrAnonymousHeadStringTagInt8PtrOnly:
p := load(ctxptr, code.idx)
if p == 0 {
code = code.end.next
break
}
store(ctxptr, code.idx, e.ptrToPtr(p))
fallthrough
case opStructFieldAnonymousHeadStringTagInt8PtrOnly:
p := load(ctxptr, code.idx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p+code.offset)))
b = append(b, '"')
}
b = encodeIndentComma(b)
code = code.next
case opStructFieldPtrHeadInt16:
store(ctxptr, code.idx, e.ptrToPtr(load(ctxptr, code.idx)))
fallthrough
@ -3047,34 +3362,6 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadOmitEmptyInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = e.encodeIndent(b, code.indent)
b = append(b, '{', '\n')
v := e.ptrToInt8(ptr + code.offset)
if v == 0 {
code = code.nextField
} else {
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
code = code.next
}
}
case opStructFieldPtrHeadOmitEmptyInt16:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -3463,29 +3750,6 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
code = code.next
store(ctxptr, code.idx, p)
}
case opStructFieldPtrHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
store(ctxptr, code.idx, e.ptrToPtr(ptr))
}
fallthrough
case opStructFieldHeadStringTagInt8:
ptr := load(ctxptr, code.idx)
if ptr == 0 {
b = e.encodeIndent(b, code.indent)
b = encodeNull(b)
b = encodeIndentComma(b)
code = code.end.next
} else {
b = append(b, '{', '\n')
b = e.encodeIndent(b, code.indent+1)
b = append(b, code.key...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
}
case opStructFieldPtrHeadStringTagInt16:
ptr := load(ctxptr, code.idx)
if ptr != 0 {
@ -3804,6 +4068,26 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
case opStructFieldOmitEmptyInt:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldStringTagInt:
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
case opStructFieldInt8:
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
@ -3812,6 +4096,27 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = encodeIndentComma(b)
code = code.next
case opStructFieldOmitEmptyInt8:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt8(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldStringTagInt8:
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
case opStructFieldInt16:
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
@ -4037,28 +4342,6 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
code = code.next
store(ctxptr, code.idx, p)
}
case opStructFieldOmitEmptyInt:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldOmitEmptyInt8:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt8(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = encodeIndentComma(b)
}
code = code.next
case opStructFieldOmitEmptyInt16:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt16(ptr + code.offset)
@ -4288,24 +4571,6 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = append(b, ' ')
code = code.next
store(ctxptr, code.idx, p)
case opStructFieldStringTagInt:
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
case opStructFieldStringTagInt8:
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = encodeIndentComma(b)
code = code.next
case opStructFieldStringTagInt16:
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
@ -4570,6 +4835,35 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndOmitEmptyInt8:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt8(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(v))
b = e.appendStructEndIndent(b, code.indent-1)
} else {
last := len(b) - 1
if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}'
} else {
b = append(b, '}')
}
b = encodeIndentComma(b)
}
code = code.next
case opStructEndStringTagInt8:
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndInt8Ptr:
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
@ -4583,6 +4877,41 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndOmitEmptyInt8Ptr:
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(e.ptrToInt8(p)))
b = e.appendStructEndIndent(b, code.indent-1)
} else {
last := len(b) - 1
if b[last-1] == '{' {
// doesn't exist any fields
b[last] = '}'
} else {
b = append(b, '}')
}
b = encodeIndentComma(b)
}
code = code.next
case opStructEndStringTagInt8Ptr:
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
ptr := load(ctxptr, code.headIdx)
p := e.ptrToPtr(ptr + code.offset)
if p == 0 {
b = encodeNull(b)
} else {
b = append(b, '"')
b = appendInt(b, int64(e.ptrToInt8(p)))
b = append(b, '"')
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndInt16:
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
@ -4843,17 +5172,6 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
b = append(b, buf.Bytes()...)
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndOmitEmptyInt8:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt8(ptr + code.offset)
if v != 0 {
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ')
b = appendInt(b, int64(v))
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndOmitEmptyInt16:
ptr := load(ctxptr, code.headIdx)
v := e.ptrToInt16(ptr + code.offset)
@ -5000,15 +5318,6 @@ func (e *Encoder) runIndent(ctx *encodeRuntimeContext, b []byte, code *opcode) (
}
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndStringTagInt8:
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)
b = append(b, code.key...)
b = append(b, ' ', '"')
b = appendInt(b, int64(e.ptrToInt8(ptr+code.offset)))
b = append(b, '"')
b = e.appendStructEndIndent(b, code.indent-1)
code = code.next
case opStructEndStringTagInt16:
ptr := load(ctxptr, code.headIdx)
b = e.encodeIndent(b, code.indent)