forked from mirror/go-json
Save iter value
This commit is contained in:
parent
f297c99af1
commit
3e4e83bf34
|
@ -21,6 +21,10 @@ func store(base uintptr, idx uintptr, p uintptr) {
|
||||||
*(*uintptr)(unsafe.Pointer(base + idx)) = p
|
*(*uintptr)(unsafe.Pointer(base + idx)) = p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
globalArray = []interface{}{}
|
||||||
|
)
|
||||||
|
|
||||||
func (e *Encoder) run(ctx *encodeRuntimeContext, code *opcode) error {
|
func (e *Encoder) run(ctx *encodeRuntimeContext, code *opcode) error {
|
||||||
recursiveLevel := 0
|
recursiveLevel := 0
|
||||||
seenPtr := map[uintptr]struct{}{}
|
seenPtr := map[uintptr]struct{}{}
|
||||||
|
@ -430,6 +434,7 @@ func (e *Encoder) run(ctx *encodeRuntimeContext, code *opcode) error {
|
||||||
mlen := maplen(unsafe.Pointer(ptr))
|
mlen := maplen(unsafe.Pointer(ptr))
|
||||||
if mlen > 0 {
|
if mlen > 0 {
|
||||||
iter := mapiterinit(code.typ, unsafe.Pointer(ptr))
|
iter := mapiterinit(code.typ, unsafe.Pointer(ptr))
|
||||||
|
globalArray = append(globalArray, iter)
|
||||||
store(ctxptr, code.elemIdx, 0)
|
store(ctxptr, code.elemIdx, 0)
|
||||||
store(ctxptr, code.length, uintptr(mlen))
|
store(ctxptr, code.length, uintptr(mlen))
|
||||||
store(ctxptr, code.mapIter, uintptr(iter))
|
store(ctxptr, code.mapIter, uintptr(iter))
|
||||||
|
|
Loading…
Reference in New Issue