mirror of https://github.com/goccy/go-json.git
Merge pull request #294 from goccy/feature/fix-uint64-conversion
Fix conversion from pointer to uint64
This commit is contained in:
commit
faa7ca28a7
|
@ -40,7 +40,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
store(ctxptr, code.Idx, p)
|
||||
fallthrough
|
||||
case encoder.OpInt:
|
||||
b = appendInt(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpUintPtr:
|
||||
|
@ -54,18 +54,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
store(ctxptr, code.Idx, p)
|
||||
fallthrough
|
||||
case encoder.OpUint:
|
||||
b = appendUint(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpIntString:
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpUintString:
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -662,7 +662,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructPtrHeadOmitEmptyInt:
|
||||
|
@ -692,13 +692,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
}
|
||||
|
@ -731,7 +731,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -762,14 +762,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -806,7 +806,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -840,7 +840,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -877,7 +877,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -913,7 +913,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -946,7 +946,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructPtrHeadOmitEmptyUint:
|
||||
|
@ -976,13 +976,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
}
|
||||
|
@ -1015,7 +1015,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -1046,14 +1046,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -1090,7 +1090,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -1124,7 +1124,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -1161,7 +1161,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -1197,7 +1197,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3473,16 +3473,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructFieldInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3490,18 +3490,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyIntString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3513,7 +3513,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -3522,7 +3522,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3534,7 +3534,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -3545,7 +3545,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3553,16 +3553,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructFieldUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3570,18 +3570,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyUintString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3593,7 +3593,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -3602,7 +3602,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3614,7 +3614,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -3625,7 +3625,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -4357,16 +4357,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructEndInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4376,18 +4376,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyIntString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
@ -4401,7 +4401,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
|
@ -4410,7 +4410,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4424,7 +4424,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
|
@ -4435,7 +4435,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
@ -4445,16 +4445,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructEndUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4464,18 +4464,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyUintString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
@ -4489,7 +4489,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
|
@ -4498,7 +4498,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4512,7 +4512,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
|
@ -4523,7 +4523,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
|
|
@ -53,7 +53,18 @@ func numMask(numBitSize uint8) uint64 {
|
|||
return 1<<numBitSize - 1
|
||||
}
|
||||
|
||||
func AppendInt(_ *RuntimeContext, out []byte, u64 uint64, code *Opcode) []byte {
|
||||
func AppendInt(_ *RuntimeContext, out []byte, p uintptr, code *Opcode) []byte {
|
||||
var u64 uint64
|
||||
switch code.NumBitSize {
|
||||
case 8:
|
||||
u64 = (uint64)(**(**uint8)(unsafe.Pointer(&p)))
|
||||
case 16:
|
||||
u64 = (uint64)(**(**uint16)(unsafe.Pointer(&p)))
|
||||
case 32:
|
||||
u64 = (uint64)(**(**uint32)(unsafe.Pointer(&p)))
|
||||
case 64:
|
||||
u64 = **(**uint64)(unsafe.Pointer(&p))
|
||||
}
|
||||
mask := numMask(code.NumBitSize)
|
||||
n := u64 & mask
|
||||
negative := (u64>>(code.NumBitSize-1))&1 == 1
|
||||
|
@ -96,7 +107,18 @@ func AppendInt(_ *RuntimeContext, out []byte, u64 uint64, code *Opcode) []byte {
|
|||
return append(out, b[i:]...)
|
||||
}
|
||||
|
||||
func AppendUint(_ *RuntimeContext, out []byte, u64 uint64, code *Opcode) []byte {
|
||||
func AppendUint(_ *RuntimeContext, out []byte, p uintptr, code *Opcode) []byte {
|
||||
var u64 uint64
|
||||
switch code.NumBitSize {
|
||||
case 8:
|
||||
u64 = (uint64)(**(**uint8)(unsafe.Pointer(&p)))
|
||||
case 16:
|
||||
u64 = (uint64)(**(**uint16)(unsafe.Pointer(&p)))
|
||||
case 32:
|
||||
u64 = (uint64)(**(**uint32)(unsafe.Pointer(&p)))
|
||||
case 64:
|
||||
u64 = **(**uint64)(unsafe.Pointer(&p))
|
||||
}
|
||||
mask := numMask(code.NumBitSize)
|
||||
n := u64 & mask
|
||||
if n < 10 {
|
||||
|
|
|
@ -68,7 +68,19 @@ func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr {
|
|||
return p
|
||||
}
|
||||
|
||||
func ptrToUint64(p uintptr) uint64 { return **(**uint64)(unsafe.Pointer(&p)) }
|
||||
func ptrToUint64(p uintptr, bitSize uint8) uint64 {
|
||||
switch bitSize {
|
||||
case 8:
|
||||
return (uint64)(**(**uint8)(unsafe.Pointer(&p)))
|
||||
case 16:
|
||||
return (uint64)(**(**uint16)(unsafe.Pointer(&p)))
|
||||
case 32:
|
||||
return (uint64)(**(**uint32)(unsafe.Pointer(&p)))
|
||||
case 64:
|
||||
return **(**uint64)(unsafe.Pointer(&p))
|
||||
}
|
||||
return 0
|
||||
}
|
||||
func ptrToFloat32(p uintptr) float32 { return **(**float32)(unsafe.Pointer(&p)) }
|
||||
func ptrToFloat64(p uintptr) float64 { return **(**float64)(unsafe.Pointer(&p)) }
|
||||
func ptrToBool(p uintptr) bool { return **(**bool)(unsafe.Pointer(&p)) }
|
||||
|
|
|
@ -40,7 +40,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
store(ctxptr, code.Idx, p)
|
||||
fallthrough
|
||||
case encoder.OpInt:
|
||||
b = appendInt(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpUintPtr:
|
||||
|
@ -54,18 +54,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
store(ctxptr, code.Idx, p)
|
||||
fallthrough
|
||||
case encoder.OpUint:
|
||||
b = appendUint(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpIntString:
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpUintString:
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -662,7 +662,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructPtrHeadOmitEmptyInt:
|
||||
|
@ -692,13 +692,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
}
|
||||
|
@ -731,7 +731,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -762,14 +762,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -806,7 +806,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -840,7 +840,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -877,7 +877,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -913,7 +913,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -946,7 +946,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructPtrHeadOmitEmptyUint:
|
||||
|
@ -976,13 +976,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
}
|
||||
|
@ -1015,7 +1015,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -1046,14 +1046,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -1090,7 +1090,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -1124,7 +1124,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -1161,7 +1161,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -1197,7 +1197,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3473,16 +3473,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructFieldInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3490,18 +3490,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyIntString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3513,7 +3513,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -3522,7 +3522,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3534,7 +3534,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -3545,7 +3545,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3553,16 +3553,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructFieldUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3570,18 +3570,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyUintString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3593,7 +3593,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -3602,7 +3602,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3614,7 +3614,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -3625,7 +3625,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -4357,16 +4357,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructEndInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4376,18 +4376,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyIntString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
@ -4401,7 +4401,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
|
@ -4410,7 +4410,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4424,7 +4424,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
|
@ -4435,7 +4435,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
@ -4445,16 +4445,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructEndUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4464,18 +4464,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyUintString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
@ -4489,7 +4489,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
|
@ -4498,7 +4498,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4512,7 +4512,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
|
@ -4523,7 +4523,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
|
|
@ -61,7 +61,19 @@ func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr {
|
|||
return p
|
||||
}
|
||||
|
||||
func ptrToUint64(p uintptr) uint64 { return **(**uint64)(unsafe.Pointer(&p)) }
|
||||
func ptrToUint64(p uintptr, bitSize uint8) uint64 {
|
||||
switch bitSize {
|
||||
case 8:
|
||||
return (uint64)(**(**uint8)(unsafe.Pointer(&p)))
|
||||
case 16:
|
||||
return (uint64)(**(**uint16)(unsafe.Pointer(&p)))
|
||||
case 32:
|
||||
return (uint64)(**(**uint32)(unsafe.Pointer(&p)))
|
||||
case 64:
|
||||
return **(**uint64)(unsafe.Pointer(&p))
|
||||
}
|
||||
return 0
|
||||
}
|
||||
func ptrToFloat32(p uintptr) float32 { return **(**float32)(unsafe.Pointer(&p)) }
|
||||
func ptrToFloat64(p uintptr) float64 { return **(**float64)(unsafe.Pointer(&p)) }
|
||||
func ptrToBool(p uintptr) bool { return **(**bool)(unsafe.Pointer(&p)) }
|
||||
|
@ -92,17 +104,17 @@ func ptrToInterface(code *encoder.Opcode, p uintptr) interface{} {
|
|||
}))
|
||||
}
|
||||
|
||||
func appendInt(ctx *encoder.RuntimeContext, b []byte, v uint64, code *encoder.Opcode) []byte {
|
||||
func appendInt(ctx *encoder.RuntimeContext, b []byte, p uintptr, code *encoder.Opcode) []byte {
|
||||
format := ctx.Option.ColorScheme.Int
|
||||
b = append(b, format.Header...)
|
||||
b = encoder.AppendInt(ctx, b, v, code)
|
||||
b = encoder.AppendInt(ctx, b, p, code)
|
||||
return append(b, format.Footer...)
|
||||
}
|
||||
|
||||
func appendUint(ctx *encoder.RuntimeContext, b []byte, v uint64, code *encoder.Opcode) []byte {
|
||||
func appendUint(ctx *encoder.RuntimeContext, b []byte, p uintptr, code *encoder.Opcode) []byte {
|
||||
format := ctx.Option.ColorScheme.Uint
|
||||
b = append(b, format.Header...)
|
||||
b = encoder.AppendUint(ctx, b, v, code)
|
||||
b = encoder.AppendUint(ctx, b, p, code)
|
||||
return append(b, format.Footer...)
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
store(ctxptr, code.Idx, p)
|
||||
fallthrough
|
||||
case encoder.OpInt:
|
||||
b = appendInt(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpUintPtr:
|
||||
|
@ -54,18 +54,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
store(ctxptr, code.Idx, p)
|
||||
fallthrough
|
||||
case encoder.OpUint:
|
||||
b = appendUint(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpIntString:
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpUintString:
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -662,7 +662,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructPtrHeadOmitEmptyInt:
|
||||
|
@ -692,13 +692,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
}
|
||||
|
@ -731,7 +731,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -762,14 +762,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -806,7 +806,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -840,7 +840,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -877,7 +877,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -913,7 +913,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -946,7 +946,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructPtrHeadOmitEmptyUint:
|
||||
|
@ -976,13 +976,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
}
|
||||
|
@ -1015,7 +1015,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -1046,14 +1046,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -1090,7 +1090,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -1124,7 +1124,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -1161,7 +1161,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -1197,7 +1197,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3473,16 +3473,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructFieldInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3490,18 +3490,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyIntString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3513,7 +3513,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -3522,7 +3522,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3534,7 +3534,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -3545,7 +3545,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3553,16 +3553,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructFieldUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3570,18 +3570,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyUintString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3593,7 +3593,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -3602,7 +3602,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3614,7 +3614,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -3625,7 +3625,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -4357,16 +4357,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructEndInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4376,18 +4376,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyIntString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
@ -4401,7 +4401,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
|
@ -4410,7 +4410,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4424,7 +4424,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
|
@ -4435,7 +4435,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
@ -4445,16 +4445,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructEndUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4464,18 +4464,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyUintString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
@ -4489,7 +4489,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
|
@ -4498,7 +4498,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4512,7 +4512,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
|
@ -4523,7 +4523,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
|
|
@ -63,7 +63,20 @@ func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr {
|
|||
return p
|
||||
}
|
||||
|
||||
func ptrToUint64(p uintptr) uint64 { return **(**uint64)(unsafe.Pointer(&p)) }
|
||||
func ptrToUint64(p uintptr, bitSize uint8) uint64 {
|
||||
switch bitSize {
|
||||
case 8:
|
||||
return (uint64)(**(**uint8)(unsafe.Pointer(&p)))
|
||||
case 16:
|
||||
return (uint64)(**(**uint16)(unsafe.Pointer(&p)))
|
||||
case 32:
|
||||
return (uint64)(**(**uint32)(unsafe.Pointer(&p)))
|
||||
case 64:
|
||||
return **(**uint64)(unsafe.Pointer(&p))
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func ptrToFloat32(p uintptr) float32 { return **(**float32)(unsafe.Pointer(&p)) }
|
||||
func ptrToFloat64(p uintptr) float64 { return **(**float64)(unsafe.Pointer(&p)) }
|
||||
func ptrToBool(p uintptr) bool { return **(**bool)(unsafe.Pointer(&p)) }
|
||||
|
@ -94,17 +107,17 @@ func ptrToInterface(code *encoder.Opcode, p uintptr) interface{} {
|
|||
}))
|
||||
}
|
||||
|
||||
func appendInt(ctx *encoder.RuntimeContext, b []byte, v uint64, code *encoder.Opcode) []byte {
|
||||
func appendInt(ctx *encoder.RuntimeContext, b []byte, p uintptr, code *encoder.Opcode) []byte {
|
||||
format := ctx.Option.ColorScheme.Int
|
||||
b = append(b, format.Header...)
|
||||
b = encoder.AppendInt(ctx, b, v, code)
|
||||
b = encoder.AppendInt(ctx, b, p, code)
|
||||
return append(b, format.Footer...)
|
||||
}
|
||||
|
||||
func appendUint(ctx *encoder.RuntimeContext, b []byte, v uint64, code *encoder.Opcode) []byte {
|
||||
func appendUint(ctx *encoder.RuntimeContext, b []byte, p uintptr, code *encoder.Opcode) []byte {
|
||||
format := ctx.Option.ColorScheme.Uint
|
||||
b = append(b, format.Header...)
|
||||
b = encoder.AppendUint(ctx, b, v, code)
|
||||
b = encoder.AppendUint(ctx, b, p, code)
|
||||
return append(b, format.Footer...)
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
store(ctxptr, code.Idx, p)
|
||||
fallthrough
|
||||
case encoder.OpInt:
|
||||
b = appendInt(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpUintPtr:
|
||||
|
@ -54,18 +54,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
store(ctxptr, code.Idx, p)
|
||||
fallthrough
|
||||
case encoder.OpUint:
|
||||
b = appendUint(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpIntString:
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpUintString:
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -662,7 +662,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructPtrHeadOmitEmptyInt:
|
||||
|
@ -692,13 +692,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
}
|
||||
|
@ -731,7 +731,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -762,14 +762,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -806,7 +806,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -840,7 +840,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -877,7 +877,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -913,7 +913,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -946,7 +946,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructPtrHeadOmitEmptyUint:
|
||||
|
@ -976,13 +976,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
}
|
||||
|
@ -1015,7 +1015,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -1046,14 +1046,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -1090,7 +1090,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -1124,7 +1124,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -1161,7 +1161,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -1197,7 +1197,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3473,16 +3473,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructFieldInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3490,18 +3490,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyIntString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3513,7 +3513,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -3522,7 +3522,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3534,7 +3534,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -3545,7 +3545,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3553,16 +3553,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructFieldUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3570,18 +3570,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyUintString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3593,7 +3593,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -3602,7 +3602,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3614,7 +3614,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -3625,7 +3625,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -4357,16 +4357,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructEndInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4376,18 +4376,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyIntString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
@ -4401,7 +4401,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
|
@ -4410,7 +4410,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4424,7 +4424,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
|
@ -4435,7 +4435,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
@ -4445,16 +4445,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructEndUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4464,18 +4464,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyUintString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
@ -4489,7 +4489,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
|
@ -4498,7 +4498,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4512,7 +4512,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
|
@ -4523,7 +4523,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
|
|
@ -70,7 +70,19 @@ func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr {
|
|||
return p
|
||||
}
|
||||
|
||||
func ptrToUint64(p uintptr) uint64 { return **(**uint64)(unsafe.Pointer(&p)) }
|
||||
func ptrToUint64(p uintptr, bitSize uint8) uint64 {
|
||||
switch bitSize {
|
||||
case 8:
|
||||
return (uint64)(**(**uint8)(unsafe.Pointer(&p)))
|
||||
case 16:
|
||||
return (uint64)(**(**uint16)(unsafe.Pointer(&p)))
|
||||
case 32:
|
||||
return (uint64)(**(**uint32)(unsafe.Pointer(&p)))
|
||||
case 64:
|
||||
return **(**uint64)(unsafe.Pointer(&p))
|
||||
}
|
||||
return 0
|
||||
}
|
||||
func ptrToFloat32(p uintptr) float32 { return **(**float32)(unsafe.Pointer(&p)) }
|
||||
func ptrToFloat64(p uintptr) float64 { return **(**float64)(unsafe.Pointer(&p)) }
|
||||
func ptrToBool(p uintptr) bool { return **(**bool)(unsafe.Pointer(&p)) }
|
||||
|
|
|
@ -40,7 +40,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
store(ctxptr, code.Idx, p)
|
||||
fallthrough
|
||||
case encoder.OpInt:
|
||||
b = appendInt(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpUintPtr:
|
||||
|
@ -54,18 +54,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
store(ctxptr, code.Idx, p)
|
||||
fallthrough
|
||||
case encoder.OpUint:
|
||||
b = appendUint(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpIntString:
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpUintString:
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code)
|
||||
b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -662,7 +662,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructPtrHeadOmitEmptyInt:
|
||||
|
@ -692,13 +692,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
}
|
||||
|
@ -731,7 +731,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -762,14 +762,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -806,7 +806,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -840,7 +840,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -877,7 +877,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -913,7 +913,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -946,7 +946,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructPtrHeadOmitEmptyUint:
|
||||
|
@ -976,13 +976,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
}
|
||||
|
@ -1015,7 +1015,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -1046,14 +1046,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if code.Flags&encoder.AnonymousHeadFlags == 0 {
|
||||
b = appendStructHead(ctx, b)
|
||||
}
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v == 0 {
|
||||
code = code.NextField
|
||||
} else {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -1090,7 +1090,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -1124,7 +1124,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
}
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -1161,7 +1161,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -1197,7 +1197,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3473,16 +3473,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructFieldInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3490,18 +3490,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyIntString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3513,7 +3513,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -3522,7 +3522,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3534,7 +3534,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -3545,7 +3545,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3553,16 +3553,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructFieldUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3570,18 +3570,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructFieldOmitEmptyUintString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -3593,7 +3593,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
code = code.Next
|
||||
|
@ -3602,7 +3602,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
code = code.Next
|
||||
|
@ -3614,7 +3614,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendComma(ctx, b)
|
||||
|
@ -3625,7 +3625,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendComma(ctx, b)
|
||||
}
|
||||
|
@ -4357,16 +4357,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructEndInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyInt:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4376,18 +4376,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyIntString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, u64, code)
|
||||
b = appendInt(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
@ -4401,7 +4401,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
|
@ -4410,7 +4410,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4424,7 +4424,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
|
@ -4435,7 +4435,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendInt(ctx, b, ptrToUint64(p), code)
|
||||
b = appendInt(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
@ -4445,16 +4445,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
case encoder.OpStructEndUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyUint:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4464,18 +4464,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p := load(ctxptr, code.Idx)
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
case encoder.OpStructEndOmitEmptyUintString:
|
||||
p := load(ctxptr, code.Idx)
|
||||
u64 := ptrToUint64(p + uintptr(code.Offset))
|
||||
u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
|
||||
v := u64 & ((1 << code.NumBitSize) - 1)
|
||||
if v != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, u64, code)
|
||||
b = appendUint(ctx, b, p+uintptr(code.Offset), code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
@ -4489,7 +4489,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p == 0 {
|
||||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
code = code.Next
|
||||
|
@ -4498,7 +4498,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
|
||||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
b = appendStructEndSkipLast(ctx, code, b)
|
||||
|
@ -4512,7 +4512,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
b = appendNull(ctx, b)
|
||||
} else {
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
}
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
|
@ -4523,7 +4523,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]b
|
|||
if p != 0 {
|
||||
b = appendStructKey(ctx, code, b)
|
||||
b = append(b, '"')
|
||||
b = appendUint(ctx, b, ptrToUint64(p), code)
|
||||
b = appendUint(ctx, b, p, code)
|
||||
b = append(b, '"')
|
||||
b = appendStructEnd(ctx, code, b)
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue