2
0
Fork 0
mirror of https://github.com/ii64/sonic.git synced 2026-06-21 00:46:43 +08:00

feat: rewrite generic decoder in Go, using Finite State Machine

This commit is contained in:
chenzhuoyu 2021-06-16 19:44:49 +08:00 committed by Oxygen
parent 34fa8d64a8
commit b2fbad7b4c
42 changed files with 1157 additions and 1542 deletions

View file

@ -9,6 +9,7 @@ header:
paths-ignore: paths-ignore:
- 'ast/asm.s' # empty file - 'ast/asm.s' # empty file
- 'decoder/asm.s' # empty file
- 'encoder/asm.s' # empty file - 'encoder/asm.s' # empty file
- 'internal/caching/asm.s' # empty file - 'internal/caching/asm.s' # empty file
- 'internal/jit/asm.s' # empty file - 'internal/jit/asm.s' # empty file

View file

@ -2,6 +2,8 @@
A blazingly fast JSON serializing & deserializing library, accelerated by JIT(just-in-time compiling) and SIMD(single-instruction-multi-data). A blazingly fast JSON serializing & deserializing library, accelerated by JIT(just-in-time compiling) and SIMD(single-instruction-multi-data).
**WARNING: This is still in alpha stage, use with care !**
## Benchmarks ## Benchmarks
For all sizes of json and all scenes of usage, Sonic performs almost best. For all sizes of json and all scenes of usage, Sonic performs almost best.
- Small (400B, 11 keys, 3 levels) - Small (400B, 11 keys, 3 levels)

View file

@ -23,6 +23,7 @@ import (
`github.com/bytedance/sonic/internal/native/types` `github.com/bytedance/sonic/internal/native/types`
`github.com/bytedance/sonic/internal/rt` `github.com/bytedance/sonic/internal/rt`
`github.com/bytedance/sonic/unquote`
) )
const ( const (
@ -36,8 +37,9 @@ const (
) )
const ( const (
V_RAW types.ValueType = 1 << 4 V_NODE_BASE types.ValueType = 32768
V_NUMBER types.ValueType = 10 V_RAW types.ValueType = 1 << 16
V_NUMBER = V_NODE_BASE + 0
V_ARRAY_RAW = V_RAW | types.V_ARRAY V_ARRAY_RAW = V_RAW | types.V_ARRAY
V_OBJECT_RAW = V_RAW | types.V_OBJECT V_OBJECT_RAW = V_RAW | types.V_OBJECT
MASK_RAW = V_RAW - 1 MASK_RAW = V_RAW - 1
@ -631,7 +633,7 @@ func (self *Node) loadNextPair() (*Pair, types.ParsingError) {
/* check for escape sequence */ /* check for escape sequence */
if njs.Ep != -1 { if njs.Ep != -1 {
if key, err = UnquoteString(key); err != 0 { if key, err = unquote.String(key); err != 0 {
return nil, err return nil, err
} }
} }

View file

@ -59,8 +59,8 @@ func TestMap(t *testing.T) {
assert.Equal(t, m, map[string]interface{}{ assert.Equal(t, m, map[string]interface{}{
"a": float64(0), "a": float64(0),
"b": float64(1), "b": float64(1),
"c": float64(-1.2), "c": -1.2,
"d": float64(-1.2e-10), "d": -1.2e-10,
}) })
m1 := node.MapUseNumber() m1 := node.MapUseNumber()
assert.Equal(t, m1, map[string]interface{}{ assert.Equal(t, m1, map[string]interface{}{
@ -79,9 +79,9 @@ func TestArray(t *testing.T) {
m := node.Array() m := node.Array()
assert.Equal(t, m, []interface{}{ assert.Equal(t, m, []interface{}{
float64(0), float64(0),
float64(1), float64(1),
float64(-1.2), -1.2,
float64(-1.2e-10), -1.2e-10,
}) })
m1 := node.ArrayUseNumber() m1 := node.ArrayUseNumber()
assert.Equal(t, m1, []interface{}{ assert.Equal(t, m1, []interface{}{

View file

@ -17,12 +17,13 @@
package ast package ast
import ( import (
`sync` `sync`
`unsafe` `unsafe`
`github.com/bytedance/sonic/internal/native` `github.com/bytedance/sonic/internal/native`
`github.com/bytedance/sonic/internal/native/types` `github.com/bytedance/sonic/internal/native/types`
`github.com/bytedance/sonic/internal/rt` `github.com/bytedance/sonic/internal/rt`
`github.com/bytedance/sonic/unquote`
) )
const _DEFAULT_NODE_CAP = 16 const _DEFAULT_NODE_CAP = 16
@ -105,7 +106,7 @@ func (self *Parser) lspace(sp int) int {
func (self *Parser) decodeValue() (val types.JsonState) { func (self *Parser) decodeValue() (val types.JsonState) {
sv := (*rt.GoString)(unsafe.Pointer(&self.s)) sv := (*rt.GoString)(unsafe.Pointer(&self.s))
self.p = native.Value(sv.Ptr, sv.Len, self.p, &val) self.p = native.Value(sv.Ptr, sv.Len, self.p, &val, 0)
return return
} }
@ -188,7 +189,7 @@ func (self *Parser) decodeObject(ret []Pair) (Node, types.ParsingError) {
/* check for escape sequence */ /* check for escape sequence */
if njs.Ep != -1 { if njs.Ep != -1 {
if key, err = UnquoteString(key); err != 0 { if key, err = unquote.String(key); err != 0 {
return Node{}, err return Node{}, err
} }
} }
@ -236,7 +237,7 @@ func (self *Parser) decodeString(iv int64, ep int) (Node, types.ParsingError) {
/* unquote the string */ /* unquote the string */
buf := make([]byte, 0, len(s)) buf := make([]byte, 0, len(s))
err := unquoteBytes(s, &buf) err := unquote.IntoBytes(s, &buf)
/* check for errors */ /* check for errors */
if err != 0 { if err != 0 {

View file

@ -109,7 +109,7 @@ func TestParser_Basic(t *testing.T) {
runDecoderTest(t, `{}`, map[string]interface{}{}) runDecoderTest(t, `{}`, map[string]interface{}{})
runDecoderTest(t, `["asd", "123", true, false, null, 2.4, 1.2e15]`, []interface{}{"asd", "123", true, false, nil, 2.4, 1.2e15}) runDecoderTest(t, `["asd", "123", true, false, null, 2.4, 1.2e15]`, []interface{}{"asd", "123", true, false, nil, 2.4, 1.2e15})
runDecoderTest(t, `{"asdf": "qwer", "zxcv": true}`, map[string]interface{}{"asdf": "qwer", "zxcv": true}) runDecoderTest(t, `{"asdf": "qwer", "zxcv": true}`, map[string]interface{}{"asdf": "qwer", "zxcv": true})
runDecoderTest(t, `{"a": "123", "b": true, "c": false, "d": null, "e": 2.4, "f": 1.2e15, "g": 1}`, map[string]interface{}{"a":"123", "b":true, "c":false, "d":nil, "e":float64(2.4), "f":float64(1.2e15), "g":float64(1)}) runDecoderTest(t, `{"a": "123", "b": true, "c": false, "d": null, "e": 2.4, "f": 1.2e15, "g": 1}`, map[string]interface{}{"a":"123", "b":true, "c":false, "d":nil, "e": 2.4, "f": 1.2e15, "g":float64(1)})
runDecoderTestUseNumber(t, `null`, nil) runDecoderTestUseNumber(t, `null`, nil)
runDecoderTestUseNumber(t, `true`, true) runDecoderTestUseNumber(t, `true`, true)
@ -120,38 +120,38 @@ func TestParser_Basic(t *testing.T) {
runDecoderTestUseNumber(t, `-0`, float64(0)) runDecoderTestUseNumber(t, `-0`, float64(0))
runDecoderTestUseNumber(t, `123456`, float64(123456)) runDecoderTestUseNumber(t, `123456`, float64(123456))
runDecoderTestUseNumber(t, `-12345`, float64(-12345)) runDecoderTestUseNumber(t, `-12345`, float64(-12345))
runDecoderTestUseNumber(t, `0.2`, float64(0.2)) runDecoderTestUseNumber(t, `0.2`, 0.2)
runDecoderTestUseNumber(t, `1.2`, float64(1.2)) runDecoderTestUseNumber(t, `1.2`, 1.2)
runDecoderTestUseNumber(t, `-0.2`, float64(-0.2)) runDecoderTestUseNumber(t, `-0.2`, -0.2)
runDecoderTestUseNumber(t, `-1.2`, float64(-1.2)) runDecoderTestUseNumber(t, `-1.2`, -1.2)
runDecoderTestUseNumber(t, `0e12`, float64(0e12)) runDecoderTestUseNumber(t, `0e12`, 0e12)
runDecoderTestUseNumber(t, `0e+12`, float64(0e+12)) runDecoderTestUseNumber(t, `0e+12`, 0e+12)
runDecoderTestUseNumber(t, `0e-12`, float64(0e-12)) runDecoderTestUseNumber(t, `0e-12`, 0e-12)
runDecoderTestUseNumber(t, `-0e12`, float64(-0e12)) runDecoderTestUseNumber(t, `-0e12`, -0e12)
runDecoderTestUseNumber(t, `-0e+12`, float64(-0e+12)) runDecoderTestUseNumber(t, `-0e+12`, -0e+12)
runDecoderTestUseNumber(t, `-0e-12`, float64(-0e-12)) runDecoderTestUseNumber(t, `-0e-12`, -0e-12)
runDecoderTestUseNumber(t, `2e12`, float64(2e12)) runDecoderTestUseNumber(t, `2e12`, 2e12)
runDecoderTestUseNumber(t, `2E12`, float64(2e12)) runDecoderTestUseNumber(t, `2E12`, 2e12)
runDecoderTestUseNumber(t, `2e+12`, float64(2e+12)) runDecoderTestUseNumber(t, `2e+12`, 2e+12)
runDecoderTestUseNumber(t, `2e-12`, float64(2e-12)) runDecoderTestUseNumber(t, `2e-12`, 2e-12)
runDecoderTestUseNumber(t, `-2e12`, float64(-2e12)) runDecoderTestUseNumber(t, `-2e12`, -2e12)
runDecoderTestUseNumber(t, `-2e+12`, float64(-2e+12)) runDecoderTestUseNumber(t, `-2e+12`, -2e+12)
runDecoderTestUseNumber(t, `-2e-12`, float64(-2e-12)) runDecoderTestUseNumber(t, `-2e-12`, -2e-12)
runDecoderTestUseNumber(t, `0.2e12`, float64(0.2e12)) runDecoderTestUseNumber(t, `0.2e12`, 0.2e12)
runDecoderTestUseNumber(t, `0.2e+12`, float64(0.2e+12)) runDecoderTestUseNumber(t, `0.2e+12`, 0.2e+12)
runDecoderTestUseNumber(t, `0.2e-12`, float64(0.2e-12)) runDecoderTestUseNumber(t, `0.2e-12`, 0.2e-12)
runDecoderTestUseNumber(t, `-0.2e12`, float64(-0.2e12)) runDecoderTestUseNumber(t, `-0.2e12`, -0.2e12)
runDecoderTestUseNumber(t, `-0.2e+12`, float64(-0.2e+12)) runDecoderTestUseNumber(t, `-0.2e+12`, -0.2e+12)
runDecoderTestUseNumber(t, `-0.2e-12`, float64(-0.2e-12)) runDecoderTestUseNumber(t, `-0.2e-12`, -0.2e-12)
runDecoderTestUseNumber(t, `1.2e12`, float64(1.2e12)) runDecoderTestUseNumber(t, `1.2e12`, 1.2e12)
runDecoderTestUseNumber(t, `1.2e+12`, float64(1.2e+12)) runDecoderTestUseNumber(t, `1.2e+12`, 1.2e+12)
runDecoderTestUseNumber(t, `1.2e-12`, float64(1.2e-12)) runDecoderTestUseNumber(t, `1.2e-12`, 1.2e-12)
runDecoderTestUseNumber(t, `-1.2e12`, float64(-1.2e12)) runDecoderTestUseNumber(t, `-1.2e12`, -1.2e12)
runDecoderTestUseNumber(t, `-1.2e+12`, float64(-1.2e+12)) runDecoderTestUseNumber(t, `-1.2e+12`, -1.2e+12)
runDecoderTestUseNumber(t, `-1.2e-12`, float64(-1.2e-12)) runDecoderTestUseNumber(t, `-1.2e-12`, -1.2e-12)
runDecoderTestUseNumber(t, `-1.2E-12`, float64(-1.2e-12)) runDecoderTestUseNumber(t, `-1.2E-12`, -1.2e-12)
runDecoderTestUseNumber(t, `["asd", "123", true, false, null, 2.4, 1.2e15, 1]`, []interface{}{"asd", "123", true, false, nil, float64(2.4), float64(1.2e15), float64(1)}) runDecoderTestUseNumber(t, `["asd", "123", true, false, null, 2.4, 1.2e15, 1]`, []interface{}{"asd", "123", true, false, nil, 2.4, 1.2e15, float64(1)})
runDecoderTestUseNumber(t, `{"a": "123", "b": true, "c": false, "d": null, "e": 2.4, "f": 1.2e15, "g": 1}`, map[string]interface{}{"a":"123", "b":true, "c":false, "d":nil, "e":float64(2.4), "f":float64(1.2e15), "g":float64(1)}) runDecoderTestUseNumber(t, `{"a": "123", "b": true, "c": false, "d": null, "e": 2.4, "f": 1.2e15, "g": 1}`, map[string]interface{}{"a":"123", "b":true, "c":false, "d":nil, "e": 2.4, "f": 1.2e15, "g":float64(1)})
} }
func TestLoads(t *testing.T) { func TestLoads(t *testing.T) {
@ -159,7 +159,7 @@ func TestLoads(t *testing.T) {
if e != 0 { if e != 0 {
t.Fatal(e) t.Fatal(e)
} }
assert.Equal(t, map[string]interface{}{"a": "123", "b": true, "c": false, "d": nil, "e": float64(2.4), "f": float64(1.2e15), "g": float64(1)}, i) assert.Equal(t, map[string]interface{}{"a": "123", "b": true, "c": false, "d": nil, "e": 2.4, "f": 1.2e15, "g": float64(1)}, i)
_,i,e = LoadsUseNumber(`{"a": "123", "b": true, "c": false, "d": null, "e": 2.4, "f": 1.2e15, "g": 1}`) _,i,e = LoadsUseNumber(`{"a": "123", "b": true, "c": false, "d": null, "e": 2.4, "f": 1.2e15, "g": 1}`)
if e != 0 { if e != 0 {
t.Fatal(e) t.Fatal(e)

View file

@ -20,6 +20,7 @@ import (
`fmt` `fmt`
`github.com/bytedance/sonic/internal/native/types` `github.com/bytedance/sonic/internal/native/types`
`github.com/bytedance/sonic/unquote`
) )
type Searcher struct { type Searcher struct {
@ -113,7 +114,7 @@ func (self *Parser) searchKey(match string) types.ParsingError {
/* check for escape sequence */ /* check for escape sequence */
if njs.Ep != -1 { if njs.Ep != -1 {
if key, err = UnquoteString(key); err != 0 { if key, err = unquote.String(key); err != 0 {
return err return err
} }
} }

View file

@ -92,13 +92,13 @@ func TestLoadIndex(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
a := node.Index(3).Float64() a := node.Index(3).Float64()
assert.Equal(t, float64(-1.2e-10), a) assert.Equal(t, -1.2e-10, a)
m := node.Array() m := node.Array()
assert.Equal(t, m, []interface{}{ assert.Equal(t, m, []interface{}{
float64(0), float64(0),
float64(1), float64(1),
float64(-1.2), -1.2,
float64(-1.2e-10), -1.2e-10,
}) })
} }

View file

@ -19,21 +19,9 @@ package ast
import ( import (
`unsafe` `unsafe`
`github.com/bytedance/sonic/internal/native`
`github.com/bytedance/sonic/internal/native/types`
`github.com/bytedance/sonic/internal/rt` `github.com/bytedance/sonic/internal/rt`
) )
//go:nosplit
func i64tof(v int64) float64 {
return *(*float64)(unsafe.Pointer(&v))
}
//go:nosplit
func f64toi(v float64) int64 {
return *(*int64)(unsafe.Pointer(&v))
}
//go:nosplit //go:nosplit
func mem2ptr(s []byte) unsafe.Pointer { func mem2ptr(s []byte) unsafe.Pointer {
return (*rt.GoSlice)(unsafe.Pointer(&s)).Ptr return (*rt.GoSlice)(unsafe.Pointer(&s)).Ptr
@ -51,25 +39,3 @@ func addr2str(p unsafe.Pointer, n int64) (s string) {
return return
} }
func unquoteBytes(s string, m *[]byte) types.ParsingError {
pos := -1
slv := (*rt.GoSlice)(unsafe.Pointer(m))
str := (*rt.GoString)(unsafe.Pointer(&s))
ret := native.Unquote(str.Ptr, str.Len, slv.Ptr, &pos, 0)
/* check for errors */
if ret < 0 {
return types.ParsingError(-ret)
}
/* update the length */
slv.Len = ret
return 0
}
func UnquoteString(s string) (ret string, err types.ParsingError) {
mm := make([]byte, 0, len(s))
err = unquoteBytes(s, &mm)
ret = rt.Mem2Str(mm)
return
}

View file

@ -2214,10 +2214,10 @@ func TestUnmarshalErrorAfterMultipleJSON(t *testing.T) {
err error err error
}{{ }{{
in: `1 false null :`, in: `1 false null :`,
err: (&JsonSyntaxError{"invalid character ':' looking for beginning of value", 14}).err(), err: (&JsonSyntaxError{"invalid character ':' looking for beginning of value", 13}).err(),
}, { }, {
in: `1 [] [,]`, in: `1 [] [,]`,
err: (&JsonSyntaxError{"invalid character ',' looking for beginning of value", 7}).err(), err: (&JsonSyntaxError{"invalid character ',' looking for beginning of value", 6}).err(),
}, { }, {
in: `1 [] [true:]`, in: `1 [] [true:]`,
err: (&JsonSyntaxError{"invalid character ':' after array element", 10}).err(), err: (&JsonSyntaxError{"invalid character ':' after array element", 10}).err(),

0
decoder/asm.s Normal file
View file

View file

@ -376,7 +376,6 @@ var (
_I_int8 , _T_int8 = rtype(reflect.TypeOf(int8(0))) _I_int8 , _T_int8 = rtype(reflect.TypeOf(int8(0)))
_I_int16 , _T_int16 = rtype(reflect.TypeOf(int16(0))) _I_int16 , _T_int16 = rtype(reflect.TypeOf(int16(0)))
_I_int32 , _T_int32 = rtype(reflect.TypeOf(int32(0))) _I_int32 , _T_int32 = rtype(reflect.TypeOf(int32(0)))
_ , _T_int64 = rtype(reflect.TypeOf(int64(0)))
_I_uint8 , _T_uint8 = rtype(reflect.TypeOf(uint8(0))) _I_uint8 , _T_uint8 = rtype(reflect.TypeOf(uint8(0)))
_I_uint16 , _T_uint16 = rtype(reflect.TypeOf(uint16(0))) _I_uint16 , _T_uint16 = rtype(reflect.TypeOf(uint16(0)))
_I_uint32 , _T_uint32 = rtype(reflect.TypeOf(uint32(0))) _I_uint32 , _T_uint32 = rtype(reflect.TypeOf(uint32(0)))
@ -865,24 +864,21 @@ var (
_F_mapassign_fast64 = jit.Func(mapassign_fast64) _F_mapassign_fast64 = jit.Func(mapassign_fast64)
) )
var (
_F_decodeTypedPointer obj.Addr
_F_FieldMap_GetCaseInsensitive obj.Addr
)
var ( var (
_F_lspace = jit.Imm(int64(native.S_lspace)) _F_lspace = jit.Imm(int64(native.S_lspace))
_F_strhash = jit.Imm(int64(caching.S_strhash)) _F_strhash = jit.Imm(int64(caching.S_strhash))
) )
var ( var (
_F_b64decode = jit.Imm(int64(_subr__b64decode))
_F_skip_array = jit.Imm(int64(native.S_skip_array)) _F_skip_array = jit.Imm(int64(native.S_skip_array))
_F_skip_object = jit.Imm(int64(native.S_skip_object)) _F_skip_object = jit.Imm(int64(native.S_skip_object))
) )
var ( var (
_F_b64decode = jit.Imm(int64(_subr__b64decode)) _F_decodeGeneric obj.Addr
_F_decode_value = jit.Imm(int64(_subr_decode_value)) _F_decodeTypedPointer obj.Addr
_F_FieldMap_GetCaseInsensitive obj.Addr
) )
const ( const (
@ -892,19 +888,24 @@ const (
) )
func init() { func init() {
_F_decodeGeneric = jit.Func(decodeGeneric)
_F_decodeTypedPointer = jit.Func(decodeTypedPointer) _F_decodeTypedPointer = jit.Func(decodeTypedPointer)
_F_FieldMap_GetCaseInsensitive = jit.Func((*caching.FieldMap).GetCaseInsensitive) _F_FieldMap_GetCaseInsensitive = jit.Func((*caching.FieldMap).GetCaseInsensitive)
} }
func (self *_Assembler) _asm_OP_any(_ *_Instr) { func (self *_Assembler) _asm_OP_any(_ *_Instr) {
self.save(_VP) // SAVE VP self.Emit("MOVQ" , _ARG_fv, _AX) // MOVQ fv, AX
self.Emit("MOVQ" , _ARG_fv, _VP) // MOVQ fv, VP self.Emit("MOVQ" , _IP, jit.Ptr(_SP, 0)) // MOVQ IP, (SP)
self.call(_F_decode_value) // CALL decode_value self.Emit("MOVQ" , _IL, jit.Ptr(_SP, 8)) // MOVQ IL, 8(SP)
self.load(_VP) // LOAD VP self.Emit("MOVQ" , _IC, jit.Ptr(_SP, 16)) // MOVQ IC, 16(SP)
self.Emit("TESTQ", _EP, _EP) // TESTQ EP, EP self.Emit("MOVQ" , _AX, jit.Ptr(_SP, 24)) // MOVQ AX, 24(SP)
self.Sjmp("JNZ" , _LB_parsing_error) // JNZ _parsing_error self.call_go(_F_decodeGeneric) // CALL_GO decodeGeneric
self.Emit("MOVQ" , _R8, jit.Ptr(_VP, 0)) // MOVQ R8, (VP) self.Emit("MOVQ" , jit.Ptr(_SP, 32), _IC) // MOVQ 32(SP), IC
self.Emit("MOVQ" , _R9, jit.Ptr(_VP, 8)) // MOVQ R9, 8(VP) self.Emit("MOVOU", jit.Ptr(_SP, 40), _X0) // MOVOU 40(SP), X0
self.Emit("MOVQ" , jit.Ptr(_SP, 56), _EP) // MOVQ 56(SP), EP
self.Emit("TESTQ", _EP, _EP) // TESTQ ET, ET
self.Sjmp("JNZ" , _LB_parsing_error) // JNZ _parsing_error
self.Emit("MOVOU", _X0, jit.Ptr(_VP, 0)) // MOVOU X0, (VP)
} }
func (self *_Assembler) _asm_OP_str(_ *_Instr) { func (self *_Assembler) _asm_OP_str(_ *_Instr) {

View file

@ -109,8 +109,3 @@ func error_value(value string, vtype reflect.Type) error {
Value : value, Value : value,
} }
} }
//go:nosplit
func throw_invalid_type(vt types.ValueType) {
throw(fmt.Sprintf("invalid value type: %d", vt))
}

284
decoder/generic.go Normal file
View file

@ -0,0 +1,284 @@
/*
* Copyright 2021 ByteDance Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package decoder
import (
`encoding/json`
`reflect`
`sync`
`unsafe`
`github.com/bytedance/sonic/internal/native`
`github.com/bytedance/sonic/internal/native/types`
`github.com/bytedance/sonic/internal/rt`
`github.com/bytedance/sonic/unquote`
)
const (
_S_val = iota
_S_arr
_S_arr_0
_S_obj
_S_obj_x
_S_obj_delim
)
var (
mapVal = map[string]interface{}(nil)
mapType = rt.UnpackType(reflect.TypeOf(mapVal))
)
type _GenericDecoder struct {
types.StateMachine
Vp [types.MAX_RECURSE]*interface{}
}
func (self *_GenericDecoder) val(v interface{}) types.ParsingError {
sp := self.Sp
vt := self.Vt[sp]
/* must be a value or the first element of an array */
if vt != _S_val && vt != _S_arr_0 {
return types.ERR_INVALID_CHAR
}
/* set the value */
self.Sp--
*self.Vp[sp] = v
return 0
}
func (self *_GenericDecoder) exec(s string, i int, f uint64) (int, interface{}, types.ParsingError) {
var rv interface{}
var ss types.JsonState
var ex types.ParsingError
/* initialize the state machine */
self.Sp = 0
self.Vp[0] = &rv
self.Vt[0] = _S_val
/* string length and pointer */
slen := len(s)
sbuf := (*rt.GoString)(unsafe.Pointer(&s)).Ptr
/* run until the state goes empty */
for self.Sp >= 0 {
switch i = native.Value(sbuf, slen, i, &ss, 1); ss.Vt {
default: {
return i, nil, types.ParsingError(-ss.Vt)
}
/* EOF */
case types.V_EOF: {
return i, nil, types.ERR_EOF
}
/* null */
case types.V_NULL: {
if ex = self.val(nil); ex != 0 {
return i - 4, nil, ex
}
}
/* boolean true */
case types.V_TRUE: {
if ex = self.val(true); ex != 0 {
return i - 4, nil, ex
}
}
/* boolean false */
case types.V_FALSE: {
if ex = self.val(false); ex != 0 {
return i - 5, nil, ex
}
}
/* strings */
case types.V_STRING: {
p := i - 1
v := s[ss.Iv:p]
/* check for escape sequence */
if ss.Ep != -1 {
if v, ex = unquote.String(v); ex != 0 {
return int(ss.Iv) - 1, nil, ex
}
}
/* check for object key */
if vt := self.Vt[self.Sp]; vt != _S_obj && vt != _S_obj_x {
if ex = self.val(v); ex != 0 {
return int(ss.Iv) - 1, nil, ex
} else {
continue
}
}
/* get the map */
ef := rt.UnpackEface(*self.Vp[self.Sp])
mp := ef.Value
/* add the delimiter */
self.Sp++
self.Vt[self.Sp] = _S_obj_delim
self.Vp[self.Sp] = (*interface{})(mapassign_faststr(mapType, mp, v))
}
/* nested arrays */
case types.V_ARRAY: {
vt := self.Vt[self.Sp]
vv := make([]interface{}, 1, 16)
/* must be a value */
if vt != _S_val && vt != _S_arr_0 {
return i - 1, nil, types.ERR_INVALID_CHAR
}
/* set the value */
self.Vt[self.Sp] = _S_arr
*self.Vp[self.Sp] = vv
/* add the first element */
self.Sp++
self.Vt[self.Sp] = _S_arr_0
self.Vp[self.Sp] = &vv[0]
}
/* nested objects */
case types.V_OBJECT: {
vt := self.Vt[self.Sp]
vv := map[string]interface{}{}
/* must be a value */
if vt != _S_val && vt != _S_arr_0 {
return i - 1, nil, types.ERR_INVALID_CHAR
}
/* set the value */
self.Vt[self.Sp] = _S_obj
*self.Vp[self.Sp] = vv
}
/* floating point numbers */
case types.V_DOUBLE: {
if (f & (1 << _F_use_number)) == 0 {
if ex = self.val(ss.Dv); ex != 0 {
return ss.Ep, nil, ex
}
} else {
if ex = self.val(json.Number(s[ss.Ep:i])); ex != 0 {
return ss.Ep, nil, ex
}
}
}
/* integers */
case types.V_INTEGER: {
if (f & (1 << _F_use_number)) != 0 {
if ex = self.val(json.Number(s[ss.Ep:i])); ex != 0 {
return ss.Ep, nil, ex
}
} else if (f & (1 << _F_use_int64)) == 0 {
if ex = self.val(float64(ss.Iv)); ex != 0 {
return ss.Ep, nil, ex
}
} else {
if ex = self.val(ss.Iv); ex != 0 {
return ss.Ep, nil, ex
}
}
}
/* key separator ':' */
case types.V_KEY_SEP: {
if self.Vt[self.Sp] == _S_obj_delim {
self.object_elem()
} else {
return i - 1, nil, types.ERR_INVALID_CHAR
}
}
/* element separator ',' */
case types.V_ELEM_SEP: {
switch self.Vt[self.Sp] {
case _S_obj : self.Vt[self.Sp] = _S_obj_x
case _S_arr : self.array_push(self.Vp[self.Sp])
default : return i - 1, nil, types.ERR_INVALID_CHAR
}
}
/* array end ']' */
case types.V_ARRAY_END: {
switch self.Vt[self.Sp] {
case _S_arr : self.Sp--
case _S_arr_0 : self.array_end()
default : return i - 1, nil, types.ERR_INVALID_CHAR
}
}
/* object end '}' */
case types.V_OBJECT_END: {
if self.Vt[self.Sp] == _S_obj {
self.Sp--
} else {
return i - 1, nil, types.ERR_INVALID_CHAR
}
}
}
}
/* all done */
return i, rv, 0
}
func (self *_GenericDecoder) array_end() {
(*rt.GoSlice)((*rt.GoEface)(unsafe.Pointer(self.Vp[self.Sp - 1])).Value).Len = 0
self.Sp -= 2
}
func (self *_GenericDecoder) array_add(v *interface{}) *interface{} {
vv := (*[]interface{})((*rt.GoEface)(unsafe.Pointer(v)).Value)
nb := len(*vv)
*vv = append(*vv, nil)
return &(*vv)[nb]
}
func (self *_GenericDecoder) array_push(v *interface{}) {
self.Sp++
self.Vt[self.Sp] = _S_val
self.Vp[self.Sp] = self.array_add(v)
}
func (self *_GenericDecoder) object_elem() {
self.Vt[self.Sp] = _S_val
self.Vt[self.Sp - 1] = _S_obj
}
var decoderPool = sync.Pool {
New: func() interface{} {
return new(_GenericDecoder)
},
}
func decodeGeneric(s string, i int, f uint64) (p int, v interface{}, e types.ParsingError) {
dec := decoderPool.Get().(*_GenericDecoder)
p, v, e = dec.exec(s, i, f)
decoderPool.Put(dec)
return
}

View file

@ -1,358 +0,0 @@
/*
* Copyright 2021 ByteDance Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package decoder
import (
`reflect`
`unsafe`
`github.com/bytedance/sonic/internal/jit`
`github.com/bytedance/sonic/internal/native`
`github.com/bytedance/sonic/internal/native/types`
`github.com/bytedance/sonic/internal/rt`
`github.com/twitchyliquid64/golang-asm/obj`
)
const (
_VD_args = 56 // 56 bytes for passing arguments to other Go functions
_VD_saves = 40 // 40 bytes for saving the registers before CALL instructions
_VD_locals = 48 // 48 bytes for local variables
)
const (
_VD_offs = _VD_args + _VD_saves + _VD_locals
_VD_size = _VD_offs + 8 // 8 bytes for the parent frame pointer
)
const (
_LB_done = "_done"
_LB_esc_error = "_esc_error"
_LB_type_error = "_type_error"
_LB_value_error = "_value_error"
_LB_switch_table = "_switch_table"
)
var (
_RT = jit.Reg("R8")
_RV = jit.Reg("R9")
)
var (
_VAR_ss_Sp = jit.Ptr(_SP, _VD_args + _VD_saves)
_VAR_ss_Sn = jit.Ptr(_SP, _VD_args + _VD_saves + 8)
)
var (
_VAR_vv = _VAR_vv_Vt
_VAR_vv_Vt = jit.Ptr(_SP, _VD_args + _VD_saves + 24)
_VAR_vv_Dv = jit.Ptr(_SP, _VD_args + _VD_saves + 32)
_VAR_vv_Iv = jit.Ptr(_SP, _VD_args + _VD_saves + 40)
_VAR_vv_Ep = jit.Ptr(_SP, _VD_args + _VD_saves + 48)
)
//go:noescape
//goland:noinspection GoUnusedParameter
func decodeArray() unsafe.Pointer
//go:noescape
//goland:noinspection GoUnusedParameter
func decodeObject() unsafe.Pointer
type _ValueDecoder struct {
jit.BaseAssembler
}
func (self *_ValueDecoder) load() uintptr {
self.Init(self.compile)
return *(*uintptr)(self.Load("decode_value", _VD_size, 0))
}
func (self *_ValueDecoder) compile() {
self.prologue()
self.instrs()
self.epilogue()
self.errors()
self.tables()
}
func (self *_ValueDecoder) epilogue() {
self.Link(_LB_done) // _done:
self.Emit("XORL", _EP, _EP) // XORL EP, EP
self.Link(_LB_error) // _error:
self.Emit("MOVQ", jit.Ptr(_SP, _VD_offs), _BP) // MOVQ _VD_offs(SP), BP
self.Emit("ADDQ", jit.Imm(_VD_size), _SP) // ADDQ $_VD_size, SP
self.Emit("RET")
}
func (self *_ValueDecoder) prologue() {
self.Emit("SUBQ", jit.Imm(_VD_size), _SP) // SUBQ $_VD_size, SP
self.Emit("MOVQ", _BP, jit.Ptr(_SP, _VD_offs)) // MOVQ BP, _VD_offs(SP)
self.Emit("LEAQ", jit.Ptr(_SP, _VD_offs), _BP) // LEAQ _VD_offs(SP), BP
}
/** Decoder Assembler **/
var (
_Vp_zero = unsafe.Pointer(&struct{}{})
_Vp_true = rt.UnpackEface(true).Value
_Vp_false = rt.UnpackEface(false).Value
)
var (
_V_max = jit.Imm(int64(types.V_MAX))
_V_eof = jit.Imm(int64(types.ERR_EOF))
_F_value = jit.Imm(int64(native.S_value))
)
var (
_V_zero = jit.Imm(int64(uintptr(_Vp_zero)))
_V_true = jit.Imm(int64(uintptr(_Vp_true)))
_V_false = jit.Imm(int64(uintptr(_Vp_false)))
)
var (
_T_bool = jit.Type(reflect.TypeOf(true))
_T_string = jit.Type(reflect.TypeOf(""))
_T_float64 = jit.Type(reflect.TypeOf(0.0))
_T_json_Number = jit.Type(jsonNumberType)
)
var (
_T_iface_sl = jit.Type(reflect.TypeOf([]interface{}(nil)))
_T_iface_map = jit.Type(reflect.TypeOf(map[string]interface{}(nil)))
)
var (
_F_convTslice = jit.Func(convTslice)
_F_convTstring = jit.Func(convTstring)
)
var (
_F_decodeArray = jit.Func(decodeArray)
_F_decodeObject = jit.Func(decodeObject)
_F_throw_invalid_type = jit.Func(throw_invalid_type)
)
const (
_SW_case_V_EOF = _LB_error
_SW_case_V_NULL = _LB_done
_SW_case_V_TRUE = "_case_V_TRUE"
_SW_case_V_FALSE = "_case_V_FALSE"
_SW_case_V_ARRAY = "_case_V_ARRAY"
_SW_case_V_OBJECT = "_case_V_OBJECT"
_SW_case_V_STRING = "_case_V_STRING"
_SW_case_V_DOUBLE = "_case_V_DOUBLE"
_SW_case_V_INTEGER = "_case_V_INTEGER"
)
func (self *_ValueDecoder) call(pc obj.Addr) {
self.Emit("MOVQ", pc, _AX) // MOVQ ${pc}, AX
self.Rjmp("CALL", _AX) // CALL AX
}
func (self *_ValueDecoder) call_go(pc obj.Addr) {
self.Emit("MOVQ", _IP, jit.Ptr(_SP, _VD_args)) // MOVQ IP, args+0(SP)
self.Emit("MOVQ", _IL, jit.Ptr(_SP, _VD_args + 8)) // MOVQ IL, args+8(SP)
self.Emit("MOVQ", _IC, jit.Ptr(_SP, _VD_args + 16)) // MOVQ IC, args+16(SP)
self.Emit("MOVQ", _ST, jit.Ptr(_SP, _VD_args + 24)) // MOVQ ST, args+24(SP)
self.Emit("MOVQ", _VP, jit.Ptr(_SP, _VD_args + 32)) // MOVQ VP, args+24(SP)
self.call(pc)
self.Emit("MOVQ", jit.Ptr(_SP, _VD_args), _IP) // MOVQ args+0(SP), IP
self.Emit("MOVQ", jit.Ptr(_SP, _VD_args + 8), _IL) // MOVQ args+8(SP), IL
self.Emit("MOVQ", jit.Ptr(_SP, _VD_args + 16), _IC) // MOVQ args+16(SP), IC
self.Emit("MOVQ", jit.Ptr(_SP, _VD_args + 24), _ST) // MOVQ args+24(SP), ST
self.Emit("MOVQ", jit.Ptr(_SP, _VD_args + 32), _VP) // MOVQ args+32(SP), VP
}
func (self *_ValueDecoder) errors() {
self.Link(_LB_esc_error) // _esc_error:
self.Emit("MOVQ", _VAR_ss_Sn, _CX) // MOVQ ss.Sn, CX
self.Emit("SUBQ", _VAR_vv_Ep, _CX) // SUBQ vv.Ep, CX
self.Emit("SUBQ", _CX, _IC) // SUBQ CX, IC
self.Emit("SUBQ", jit.Imm(1), _IC) // SUBQ $1, IC
self.Link(_LB_value_error) // _value_error:
self.Emit("NEGQ", _AX) // NEGQ AX
self.Emit("MOVQ", _AX, _EP) // MOVQ AX, EP
self.Sjmp("JMP" , _LB_error) // JMP _error
self.Link(_LB_type_error) // _type_error:
self.Emit("MOVQ", _AX, jit.Ptr(_SP, 0)) // MOVQ AX, (SP)
self.call(_F_throw_invalid_type) // CALL throw_invalid_type
self.Emit("UD2") // UD2
}
func (self *_ValueDecoder) tables() {
self.Link(_LB_switch_table) // _switch_table:
self.Sref(_SW_case_V_EOF, 0) // SREF &_error, $0
self.Sref(_SW_case_V_NULL, -4) // SREF &_done, $-4
self.Sref(_SW_case_V_TRUE, -8) // SREF &_case_V_TRUE, $-8
self.Sref(_SW_case_V_FALSE, -12) // SREF &_case_V_FALSE, $-12
self.Sref(_SW_case_V_ARRAY, -16) // SREF &_case_V_ARRAY, $-16
self.Sref(_SW_case_V_OBJECT, -20) // SREF &_case_V_OBJECT, $-20
self.Sref(_SW_case_V_STRING, -24) // SREF &_case_V_STRING, $-24
self.Sref(_SW_case_V_DOUBLE, -28) // SREF &_case_V_DOUBLE, $-28
self.Sref(_SW_case_V_INTEGER, -32) // SREF &_case_V_INTEGER, $-32
}
func (self *_ValueDecoder) instrs() {
self.Emit("MOVQ", _IP, _DI) // MOVQ IP, DI
self.Emit("MOVQ", _IL, _SI) // MOVQ IL, SI
self.Emit("MOVQ", _IC, _DX) // MOVQ IC, DX
self.Emit("LEAQ", _VAR_vv, _CX) // LEAQ vv, CX
self.call(_F_value) // CALL value
self.Emit("MOVQ", _AX, _IC) // MOVQ AX, IC
self.Emit("MOVQ", _VAR_vv_Vt, _AX) // MOVQ vv.Vt, AX
/* check for errors & type range */
self.Emit("TESTQ", _AX, _AX) // TESTQ AX, AX
self.Sjmp("JS" , _LB_value_error) // JS _value_error
self.Sjmp("JZ" , _LB_type_error) // JZ _type_error
self.Emit("CMPQ" , _AX, _V_max) // CMPQ AX, ${native.V_MAX}
self.Sjmp("JA" , _LB_type_error) // JA _type_error
self.Emit("XORL" , _RT, _RT) // XORL RT, RT
self.Emit("XORL" , _RV, _RV) // XORL RV, RV
self.Emit("MOVQ" , _V_eof, _EP) // MOVQ ${native.ERR_EOF}, EP
/* jump table selector */
self.Byte(0x48, 0x8d, 0x3d) // LEAQ ?(PC), DI
self.Sref(_LB_switch_table, 4) // .... &_switch_table
self.Emit("MOVLQSX", jit.Sib(_DI, _AX, 4, -4), _AX) // MOVLQSX -4(DI)(AX*4), AX
self.Emit("ADDQ" , _DI, _AX) // ADDQ DI, AX
self.Rjmp("JMP" , _AX) // JMP AX
/* V_TRUE */
self.Link(_SW_case_V_TRUE)
self.Emit("MOVQ", _T_bool, _RT) // MOVQ ${type(bool)}, RT
self.Emit("MOVQ", _V_true, _RV) // MOVQ ${&true}, RV
self.Sjmp("JMP" , _LB_done) // JMP _done
/* V_FALSE */
self.Link(_SW_case_V_FALSE)
self.Emit("MOVQ", _T_bool, _RT) // MOVQ ${type(bool)}, RT
self.Emit("MOVQ", _V_false, _RV) // MOVQ ${&false}, RV
self.Sjmp("JMP" , _LB_done) // JMP _done
/* V_ARRAY */
self.Link(_SW_case_V_ARRAY)
self.call(_F_decodeArray) // CALL decodeArray
self.Emit("MOVQ" , _V_zero, _CX) // MOVQ ${zero}, CX
self.Emit("TESTQ" , _AX, _AX) // TESTQ AX, AX
self.Sjmp("JS" , _LB_value_error) // JS _value_error
self.Emit("CMOVQEQ", _CX, _RV) // CMOVQEQ CX, RV
self.Emit("MOVQ" , _RV, jit.Ptr(_SP, 0)) // MOVQ RV, (SP)
self.Emit("MOVQ" , _AX, jit.Ptr(_SP, 8)) // MOVQ AX, 8(SP)
self.Emit("MOVQ" , _AX, jit.Ptr(_SP, 16)) // MOVQ AX, 16(SP)
self.call_go(_F_convTslice) // CALL_GO convTslice
self.Emit("MOVQ" , _T_iface_sl, _RT) // MOVQ ${type([]interface{})}, RT
self.Emit("MOVQ" , jit.Ptr(_SP, 24), _RV) // MOVQ 24(SP), RV
self.Sjmp("JMP" , _LB_done) // JMP _done
/* V_OBJECT */
self.Link(_SW_case_V_OBJECT)
self.call(_F_decodeObject) // CALL decodeObject
self.Emit("TESTQ", _AX, _AX) // TESTQ AX, AX
self.Sjmp("JNZ" , _LB_value_error) // JNZ _value_error
self.Emit("MOVQ" , _T_iface_map, _RT) // MOVQ ${type(map[string]interface{})}, RT
self.Sjmp("JMP" , _LB_done) // JMP _done
/* V_STRING */
self.Link(_SW_case_V_STRING)
self.Emit("MOVQ" , _VAR_vv_Iv, _CX) // MOVQ vv.Iv, CX
self.Emit("MOVQ" , _IP, _DI) // MOVQ IP, DI
self.Emit("MOVQ" , _IC, _SI) // MOVQ IC, SI
self.Emit("ADDQ" , _CX, _DI) // ADDQ CX, DI
self.Emit("SUBQ" , _CX, _SI) // SUBQ CX, SI
self.Emit("SUBQ" , jit.Imm(1), _SI) // SUBQ $1, SI
self.Emit("CMPQ" , _VAR_vv_Ep, jit.Imm(-1)) // CMPQ vv.Ep, $-1
self.Sjmp("JE" , "_noescape") // JE _noescape
self.Emit("XORL" , _AX, _AX) // XORL AX, AX
self.Emit("MOVQ" , _T_byte, _CX) // MOVQ ${type(byte)}, CX
self.Emit("MOVQ" , _DI, _VAR_ss_Sp) // MOVQ DI, ss.Sp
self.Emit("MOVQ" , _SI, _VAR_ss_Sn) // MOVQ SI, ss.Sn
self.Emit("MOVQ" , _SI, jit.Ptr(_SP, 0)) // MOVQ SI, (SP)
self.Emit("MOVQ" , _CX, jit.Ptr(_SP, 8)) // MOVQ CX, 8(SP)
self.Emit("MOVQ" , _AX, jit.Ptr(_SP, 16)) // MOVQ AX, 16(SP)
self.call_go(_F_mallocgc) // CALL_GO mallocgc
self.Emit("MOVQ" , _VAR_ss_Sp, _DI) // MOVQ ss.Sp, DI
self.Emit("MOVQ" , _VAR_ss_Sn, _SI) // MOVQ ss.Sn, SI
self.Emit("MOVQ" , jit.Ptr(_SP, 24), _DX) // MOVQ 24(SP), DX
self.Emit("MOVQ" , _DX, _VAR_ss_Sp) // MOVQ DX, ss.Sp
self.Emit("LEAQ" , _VAR_vv_Ep, _CX) // LEAQ vv.Ep, CX
self.Emit("XORL" , _R8, _R8) // XORL R8, R8
self.Emit("BTQ" , jit.Imm(_F_disable_urc), _VP) // BTQ ${_F_disable_urc}, VP
self.Emit("SETCC", _R8) // SETCC R8
self.Emit("SHLQ" , jit.Imm(types.B_UNICODE_REPLACE), _R8) // SHLQ ${types.B_UNICODE_REPLACE}, R8
self.call(_F_unquote) // CALL unquote
self.Emit("TESTQ", _AX, _AX) // TESTQ AX, AX
self.Sjmp("JS" , _LB_esc_error) // JS _esc_error
self.Emit("MOVQ" , _AX, _SI) // MOVQ AX, SI
self.Emit("MOVQ" , _VAR_ss_Sp, _DI) // MOVQ ss.Sp, DI
self.Link("_noescape") // _noescape:
self.Emit("MOVQ" , _DI, jit.Ptr(_SP, 0)) // MOVQ DI, (SP)
self.Emit("MOVQ" , _SI, jit.Ptr(_SP, 8)) // MOVQ SI, 8(SP)
self.call_go(_F_convTstring) // CALL_GO convTstring
self.Emit("MOVQ" , _T_string, _RT) // MOVQ ${type(string)}, RT
self.Emit("MOVQ" , jit.Ptr(_SP, 16), _RV) // MOVQ 16(SP), RV
self.Sjmp("JMP" , _LB_done) // JMP _done
/* V_DOUBLE */
self.Link(_SW_case_V_DOUBLE)
self.Emit("BTQ" , jit.Imm(_F_use_number), _VP) // BTQ ${_F_use_number}, VP
self.Sjmp("JC" , "_use_number") // JC _use_number
self.Emit("MOVSD", _VAR_vv_Dv, _X0) // MOVSD st.Dv, X0
self.Emit("MOVSD", _X0, jit.Ptr(_SP, 0)) // MOVSD X0, (SP)
self.call_go(_F_convT64) // CALL_GO convT64
self.Emit("MOVQ" , _T_float64, _RT) // MOVQ ${type(float64)}, RT
self.Emit("MOVQ" , jit.Ptr(_SP, 8), _RV) // MOVQ 8(SP), RV
self.Sjmp("JMP" , _LB_done) // JMP _done
/* V_INTEGER */
self.Link(_SW_case_V_INTEGER)
self.Emit("BTQ" , jit.Imm(_F_use_int64), _VP) // BTQ ${_F_use_int64}, VP
self.Sjmp("JNC" , _SW_case_V_DOUBLE) // JNC _case_V_DOUBLE
self.Emit("MOVQ", _VAR_vv_Iv, _X0) // MOVQ st.Iv, AX
self.Emit("MOVQ", _X0, jit.Ptr(_SP, 0)) // MOVQ AX, (SP)
self.call_go(_F_convT64) // CALL_GO convT64
self.Emit("MOVQ", jit.Gtype(_T_int64), _RT) // MOVQ ${type(int64)}, RT
self.Emit("MOVQ", jit.Ptr(_SP, 8), _RV) // MOVQ 8(SP), RV
self.Sjmp("JMP" , _LB_done) // JMP _done
/* case when `UseNumber` is set */
self.Link("_use_number") // _use_number:
self.Emit("MOVQ", _VAR_vv_Ep, _SI) // MOVQ ${p}, SI
self.Emit("LEAQ", jit.Sib(_IP, _SI, 1, 0), _DI) // LEAQ (IP)(SI), DI
self.Emit("NEGQ", _SI) // NEGQ SI
self.Emit("LEAQ", jit.Sib(_IC, _SI, 1, 0), _SI) // LEAQ (IC)(SI), SI
self.Emit("MOVQ", _DI, jit.Ptr(_SP, 0)) // MOVQ DI, (SP)
self.Emit("MOVQ", _SI, jit.Ptr(_SP, 8)) // MOVQ SI, 8(SP)
self.call_go(_F_convTstring) // CALL_GO convTstring
self.Emit("MOVQ", _T_json_Number, _RT) // MOVQ ${type(json.Number)}, RT
self.Emit("MOVQ", jit.Ptr(_SP, 16), _RV) // MOVQ 16(SP), RV
}
// These are referenced in `generic_amd64.s`
//goland:noinspection GoUnusedGlobalVariable
var (
_type_byte = rt.UnpackType(reflect.TypeOf(byte(0)))
_type_eface = rt.UnpackType(reflect.TypeOf((*interface{})(nil)).Elem())
_type_strmap = rt.UnpackType(reflect.TypeOf(map[string]interface{}(nil)))
)
/** Generic Decoder **/
var (
_subr_decode_value = new(_ValueDecoder).load()
)

View file

@ -1,419 +0,0 @@
//
// Copyright 2021 ByteDance Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "go_asm.h"
#include "funcdata.h"
#include "textflag.h"
// Register Allocations:
// AX result index (if any), or negative for errors
// R9 result value (slice array pointer or map pointer)
// R12 parameter string buffer
// R13 parameter string length
// R14 parameter index
// R15 decoder flags
#define ST BX
#define RT R8
#define RV R9
#define RE R11
#define PS R12
#define PN R13
#define PI R14
#define FL R15
#define ERR_EOF $-1
#define ERR_INVALID_CHAR $-2
#define lspace(to) \
MOVQ PS, DI \
MOVQ PN, SI \
MOVQ PI, DX \
MOVQ github·combytedancesonicinternalnative·S_lspace(SB), AX \
CALL AX \
MOVQ AX, PI \
TESTQ AX, AX \
JNS to \
RET \
to:
#define match_eof(to) \
MOVQ ERR_EOF, AX \
CMPQ PI, PN \
JBE to \
MOVQ PN, PI \
RET \
to:
#define match_empty(to, ch) \
CMPB (PS)(PI*1), ch \
JNE to \
XORQ AX, AX \
XORQ RV, RV \
ADDQ $1, PI \
RET \
to:
#define match_delim(done, next, ch) \
MOVBLZX (PS)(PI*1), AX \
ADDQ $1, PI \
CMPL AX, ch \
JE done \
CMPL AX, $',' \
JE next \
MOVQ ERR_INVALID_CHAR, AX \
SUBQ $1, PI \
RET \
done:
#define check_char(to, ch) \
MOVBLZX (PS)(PI*1), CX \
ADDQ $1, PI \
MOVQ ERR_INVALID_CHAR, AX \
CMPL CX, ch \
JE to \
SUBQ $1, PI \
RET \
to:
#define check_empty(to, ch) \
match_eof(_check_empty) \
match_empty(to, ch)
#define check_delim(done, next, ch) \
match_eof(_check_delim) \
match_delim(done, next, ch) \
// Generic Array Decoder
#define ARR_st fl-80(SP)
#define ARR_fl fl-72(SP)
#define ARR_ps ps-64(SP)
#define ARR_pn ps-56(SP)
#define ARR_pi pi-48(SP)
#define ARR_sp sp-40(SP)
#define ARR_sl sl-32(SP)
#define ARR_sc sc-24(SP)
#define ARR_rt sl-16(SP)
#define ARR_rv sc-8(SP)
TEXT ·decodeArray(SB), NOSPLIT, $144 - 8
NO_LOCAL_POINTERS
lspace(_check_array_empty)
check_empty(_make_slice, $']')
// set slice initial capacity to 16
XORQ CX, CX
MOVL $16, DX
MOVQ CX, ARR_sl
MOVQ DX, ARR_sc
// allocate memory for slice
MOVQ ST, ARR_st
MOVQ FL, ARR_fl
MOVQ PS, ARR_ps
MOVQ PN, ARR_pn
MOVQ PI, ARR_pi
MOVQ ·_type_eface(SB), AX
MOVQ AX, (SP)
MOVQ CX, 8(SP)
MOVQ DX, 16(SP)
CALL runtime·makeslice(SB)
MOVQ 24(SP), AX
MOVQ AX, ARR_sp
MOVQ AX, ret+0(FP)
MOVQ ARR_st, ST
MOVQ ARR_fl, FL
MOVQ ARR_ps, PS
MOVQ ARR_pn, PN
MOVQ ARR_pi, PI
GO_RESULTS_INITIALIZED
_parse_loop:
MOVQ ·_subr_decode_value(SB), AX
CALL AX
TESTQ RE, RE
JNZ _parsing_error
// check for slice space
MOVQ ARR_sp, DI
MOVQ ARR_sl, CX
CMPQ CX, ARR_sc
JAE _more_space
_append_slice:
LEAQ (DI)(CX*8), DI
LEAQ (DI)(CX*8), DI
MOVQ RT, (DI)
MOVQ RV, 8(DI)
ADDQ $1, CX
MOVQ CX, ARR_sl
// check for the delimiter
lspace(_check_array_delim)
check_delim(_done, _parse_loop, $']')
// set the result register and length
MOVQ ARR_sp, RV
MOVQ ARR_sl, AX
RET
_parsing_error:
MOVQ RE, AX
NEGQ AX
RET
_more_space:
MOVQ ST, ARR_st
MOVQ FL, ARR_fl
MOVQ PS, ARR_ps
MOVQ PN, ARR_pn
MOVQ PI, ARR_pi
MOVQ RT, ARR_rt
MOVQ RV, ARR_rv
MOVQ ARR_sc, DX
MOVQ ·_type_eface(SB), AX
MOVQ AX, (SP)
MOVQ DI, 8(SP)
MOVQ CX, 16(SP)
MOVQ DX, 24(SP)
SHLQ $1, DX
MOVQ DX, 32(SP)
CALL runtime·growslice(SB)
MOVQ 40(SP), DI
MOVQ 48(SP), CX
MOVQ 56(SP), DX
MOVQ DI, ARR_sp
MOVQ CX, ARR_sl
MOVQ DX, ARR_sc
MOVQ ARR_st, ST
MOVQ ARR_fl, FL
MOVQ ARR_ps, PS
MOVQ ARR_pn, PN
MOVQ ARR_pi, PI
MOVQ ARR_rt, RT
MOVQ ARR_rv, RV
JMP _append_slice
// Generic Object Decoder
#define OBJ_ss OBJ_ss_Sp
#define OBJ_ss_Sp ss_Sp-72(SP)
#define OBJ_ss_Sn ss_Sn-64(SP)
#define OBJ_st ps-56(SP)
#define OBJ_fl ps-48(SP)
#define OBJ_ps ps-40(SP)
#define OBJ_pn ps-32(SP)
#define OBJ_pi pi-24(SP)
#define OBJ_vp vp-16(SP)
#define OBJ_mp mp-8(SP)
TEXT ·decodeObject(SB), NOSPLIT, $104 - 8
NO_LOCAL_POINTERS
lspace(_check_object_empty)
check_empty(_make_map, $'}')
// create the result map
MOVQ ST, OBJ_st
MOVQ FL, OBJ_fl
MOVQ PS, OBJ_ps
MOVQ PN, OBJ_pn
MOVQ PI, OBJ_pi
CALL runtime·makemap_small(SB)
MOVQ (SP), AX
MOVQ AX, OBJ_mp
MOVQ AX, ret+0(FP)
MOVQ OBJ_st, ST
MOVQ OBJ_fl, FL
MOVQ OBJ_ps, PS
MOVQ OBJ_pn, PN
MOVQ OBJ_pi, PI
GO_RESULTS_INITIALIZED
_parse_loop:
CALL decodeObjectKey(SB)
MOVQ DI, OBJ_ss_Sp
MOVQ SI, OBJ_ss_Sn
TESTQ AX, AX
JNS _value_delim
RET
_value_delim:
lspace(_check_value_delim)
check_char(_parse_value, $':')
// allocate a new slot in the map
MOVQ ST, OBJ_st
MOVQ FL, OBJ_fl
MOVQ PS, OBJ_ps
MOVQ PN, OBJ_pn
MOVQ PI, OBJ_pi
MOVQ ·_type_strmap(SB), AX
MOVQ OBJ_mp, CX
MOVOU OBJ_ss, X0
MOVQ AX, (SP)
MOVQ CX, 8(SP)
MOVOU X0, 16(SP)
CALL runtime·mapassign_faststr(SB)
MOVQ 32(SP), AX
MOVQ AX, OBJ_vp
MOVQ OBJ_st, ST
MOVQ OBJ_fl, FL
MOVQ OBJ_ps, PS
MOVQ OBJ_pn, PN
MOVQ OBJ_pi, PI
// decode the value
MOVQ ·_subr_decode_value(SB), AX
CALL AX
TESTQ RE, RE
JNZ _value_error
// set the map value
MOVQ OBJ_vp, AX
MOVQ RT, (AX)
MOVQ RV, 8(AX)
// check for the delimiter
lspace(_check_object_delim)
check_delim(_done, _parse_loop, $'}')
// set the result register and clear the errors
XORQ AX, AX
MOVQ OBJ_mp, RV
RET
_value_error:
MOVQ RE, AX
NEGQ AX
RET
// Object Key Parsing Helper
#define V_STRING $7
#define F_DISABLE_URC $2
#define B_UNICODE_REPLACE $1
#define VAR_in VAR_in_PS
#define VAR_in_ST in_PS-88(SP)
#define VAR_in_FL in_PS-80(SP)
#define VAR_in_PS in_PS-72(SP)
#define VAR_in_PN in_PN-64(SP)
#define VAR_in_PI in_PI-56(SP)
#define VAR_ss VAR_ss_Sp
#define VAR_ss_Sp ss_Sp-48(SP)
#define VAR_ss_Sn ss_Sp-40(SP)
#define VAR_vv VAR_vv_Vt
#define VAR_vv_Vt vv_Vt-32(SP)
#define VAR_vv_Dv vv_Dv-24(SP)
#define VAR_vv_Iv vv_Iv-16(SP)
#define VAR_vv_Ep vv_Ep-8(SP)
TEXT decodeObjectKey(SB), NOSPLIT, $120 - 0
NO_LOCAL_POINTERS
lspace(_parse_key_begin)
check_char(_parse_key_body, $'"')
// parse the string
MOVQ PS, VAR_in_PS
MOVQ PN, VAR_in_PN
MOVQ PI, VAR_in_PI
LEAQ VAR_in, DI
LEAQ VAR_in_PI, SI
LEAQ VAR_vv, DX
MOVQ github·combytedancesonicinternalnative·S_vstring(SB), AX
CALL AX
MOVQ VAR_in_PI, PI
// check for errors
MOVQ VAR_vv_Vt, AX
TESTQ AX, AX
JNS _check_quote
RET
_check_quote:
CMPQ AX, V_STRING
JNE _invalid_type
// extract the string
MOVQ VAR_vv_Iv, CX
MOVQ PS, DI
MOVQ PI, SI
ADDQ CX, DI
SUBQ CX, SI
SUBQ $1, SI
// check for quotes
CMPQ VAR_vv_Ep, $-1
JNE _unquote
MOVQ SI, AX
RET
_unquote:
XORQ AX, AX
MOVQ ST, VAR_in_ST
MOVQ FL, VAR_in_FL
MOVQ PS, VAR_in_PS
MOVQ PN, VAR_in_PN
MOVQ PI, VAR_in_PI
MOVQ ·_type_byte(SB), CX
MOVQ DI, VAR_ss_Sp
MOVQ SI, VAR_ss_Sn
// allocate space for unquoted string
MOVQ SI, (SP)
MOVQ CX, 8(SP)
MOVQ AX, 16(SP)
CALL runtime·mallocgc(SB)
MOVQ 24(SP), DX
MOVQ VAR_in_ST, ST
MOVQ VAR_in_FL, FL
MOVQ VAR_in_PS, PS
MOVQ VAR_in_PN, PN
MOVQ VAR_in_PI, PI
// unquote the string
MOVQ VAR_ss_Sp, DI
MOVQ VAR_ss_Sn, SI
MOVQ DX, VAR_ss_Sp
LEAQ VAR_vv_Ep, CX
XORQ R8, R8
BTQ F_DISABLE_URC, FL
SETCC R8
SHLQ B_UNICODE_REPLACE, R8
MOVQ github·combytedancesonicinternalnative·S_unquote(SB), AX
CALL AX
TESTQ AX, AX
JS _escape_error
MOVQ AX, SI
MOVQ VAR_ss_Sp, DI
RET
_escape_error:
MOVQ VAR_ss_Sn, CX
SUBQ VAR_vv_Ep, CX
SUBQ CX, PI
SUBQ $1, PI
RET
_invalid_type:
MOVQ AX, (SP)
CALL ·throw_invalid_type(SB)
BYTE $0xcc
WORD $0xfdeb

View file

@ -20,29 +20,16 @@ import (
`fmt` `fmt`
`reflect` `reflect`
`testing` `testing`
`unsafe`
`github.com/bytedance/sonic/ast` `github.com/bytedance/sonic/ast`
`github.com/bytedance/sonic/internal/native/types`
`github.com/bytedance/sonic/internal/rt`
`github.com/davecgh/go-spew/spew` `github.com/davecgh/go-spew/spew`
`github.com/stretchr/testify/require` `github.com/stretchr/testify/require`
) )
//go:nosplit
//go:noescape
//goland:noinspection GoUnusedParameter
func decodeInterface(s string, f uint64) (int, interface{}, types.ParsingError)
//go:nosplit
//go:noescape
//goland:noinspection GoUnusedParameter
func decodeObjectKeyString(s string, i int) string
func TestGeneric_DecodeInterface(t *testing.T) { func TestGeneric_DecodeInterface(t *testing.T) {
s := `[null, true, false, 1234, -1.25e-8, "hello\nworld", [], {"asdf": [1, 2.5, "qwer", null, true, false, [], {"zxcv": "fghj"}]}]` s := `[null, true, false, 1234, -1.25e-8, "hello\nworld", [], {"asdf": [1, 2.5, "qwer", null, true, false, [], {"zxcv": "fghj"}], "qwer": 7777}]`
i, v, err := decodeInterface(s, 0) i, v, err := decodeGeneric(s, 0, 0)
if err < 0 { if err != 0 {
require.NoError(t, err) require.NoError(t, err)
} }
require.Equal(t, len(s), i) require.Equal(t, len(s), i)
@ -51,14 +38,6 @@ func TestGeneric_DecodeInterface(t *testing.T) {
fmt.Printf("type: %s\n", reflect.TypeOf(v)) fmt.Printf("type: %s\n", reflect.TypeOf(v))
} }
func TestGeneric_DecodeObjectKeyString(t *testing.T) {
r := decodeObjectKeyString(` "hello\u2333world"`, 4)
if v := (*rt.GoString)(unsafe.Pointer(&r)).Len; v < 0 {
require.NoError(t, types.ParsingError(-v))
}
spew.Dump(r)
}
func BenchmarkGeneric_DecodeAST(b *testing.B) { func BenchmarkGeneric_DecodeAST(b *testing.B) {
_, _, _ = ast.Loads(TwitterJson) _, _, _ = ast.Loads(TwitterJson)
b.SetBytes(int64(len(TwitterJson))) b.SetBytes(int64(len(TwitterJson)))
@ -68,12 +47,12 @@ func BenchmarkGeneric_DecodeAST(b *testing.B) {
} }
} }
func BenchmarkGeneric_DecodeInterface(b *testing.B) { func BenchmarkGeneric_DecodeGeneric(b *testing.B) {
_, _, _ = decodeInterface(TwitterJson, 0) _, _, _ = decodeGeneric(TwitterJson, 0, 0)
b.SetBytes(int64(len(TwitterJson))) b.SetBytes(int64(len(TwitterJson)))
b.ResetTimer() b.ResetTimer()
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
_, _, _ = decodeInterface(TwitterJson, 0) _, _, _ = decodeGeneric(TwitterJson, 0, 0)
} }
} }
@ -88,13 +67,13 @@ func BenchmarkGeneric_Parallel_DecodeAST(b *testing.B) {
}) })
} }
func BenchmarkGeneric_Parallel_DecodeInterface(b *testing.B) { func BenchmarkGeneric_Parallel_DecodeGeneric(b *testing.B) {
_, _, _ = decodeInterface(TwitterJson, 0) _, _, _ = decodeGeneric(TwitterJson, 0, 0)
b.SetBytes(int64(len(TwitterJson))) b.SetBytes(int64(len(TwitterJson)))
b.ResetTimer() b.ResetTimer()
b.RunParallel(func(pb *testing.PB) { b.RunParallel(func(pb *testing.PB) {
for pb.Next() { for pb.Next() {
_, _, _ = decodeInterface(TwitterJson, 0) _, _, _ = decodeGeneric(TwitterJson, 0, 0)
} }
}) })
} }

View file

@ -1,50 +0,0 @@
//
// Copyright 2021 ByteDance Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#include "go_asm.h"
#include "funcdata.h"
#include "textflag.h"
TEXT ·decodeInterface(SB), NOSPLIT, $0 - 56
NO_LOCAL_POINTERS
MOVQ s+0(FP), R12
MOVQ n+8(FP), R13
MOVQ n+16(FP), R15
XORQ R14, R14
MOVQ ·_subr_decode_value(SB), AX
CALL AX
XORQ AX, AX
TESTQ R11, R11
CMOVQNE AX, R8
CMOVQNE AX, R9
MOVQ R14, i+24(FP)
MOVQ R8, t+32(FP)
MOVQ R9, v+40(FP)
MOVQ R11, e+48(FP)
RET
TEXT ·decodeObjectKeyString(SB), NOSPLIT, $0 - 40
NO_LOCAL_POINTERS
MOVQ s+0(FP), R12
MOVQ n+8(FP), R13
MOVQ i+16(FP), R14
CALL decodeObjectKey(SB)
XORQ CX, CX
TESTQ AX, AX
CMOVQMI CX, DI
MOVQ DI, rp+24(FP)
MOVQ AX, rl+32(FP)
RET

View file

@ -27,30 +27,12 @@ import (
//go:linkname _subr__b64decode github.com/chenzhuoyu/base64x._subr__b64decode //go:linkname _subr__b64decode github.com/chenzhuoyu/base64x._subr__b64decode
var _subr__b64decode uintptr var _subr__b64decode uintptr
//go:nosplit
//go:noescape
//go:linkname throw runtime.throw
//goland:noinspection GoUnusedParameter
func throw(s string)
//go:nosplit //go:nosplit
//go:noescape //go:noescape
//go:linkname convT64 runtime.convT64 //go:linkname convT64 runtime.convT64
//goland:noinspection GoUnusedParameter //goland:noinspection GoUnusedParameter
func convT64(v uint64) unsafe.Pointer func convT64(v uint64) unsafe.Pointer
//go:nosplit
//go:noescape
//go:linkname convTslice runtime.convTslice
//goland:noinspection GoUnusedParameter
func convTslice(v []byte) unsafe.Pointer
//go:nosplit
//go:noescape
//go:linkname convTstring runtime.convTstring
//goland:noinspection GoUnusedParameter
func convTstring(v string) unsafe.Pointer
//go:nosplit //go:nosplit
//go:noescape //go:noescape
//go:linkname memequal runtime.memequal //go:linkname memequal runtime.memequal

View file

@ -69,7 +69,7 @@ const (
const ( const (
_FP_args = 40 // 40 bytes for passing arguments to this function _FP_args = 40 // 40 bytes for passing arguments to this function
_FP_fargs = 64 // 64 bytes for passing arguments to other Go functions _FP_fargs = 64 // 64 bytes for passing arguments to other Go functions
_FP_saves = 64 // 72 bytes for saving the registers before CALL instructions _FP_saves = 64 // 64 bytes for saving the registers before CALL instructions
) )
const ( const (

View file

@ -30,7 +30,11 @@ import (
func getitab(inter *rt.GoType, typ *rt.GoType, canfail bool) *rt.GoItab func getitab(inter *rt.GoType, typ *rt.GoType, canfail bool) *rt.GoItab
func Func(f interface{}) obj.Addr { func Func(f interface{}) obj.Addr {
return Imm(*(*int64)(rt.UnpackEface(f).Value)) if p := rt.UnpackEface(f); p.Type.Kind() != reflect.Func {
panic("f is not a function")
} else {
return Imm(*(*int64)(p.Value))
}
} }
func Type(t reflect.Type) obj.Addr { func Type(t reflect.Type) obj.Addr {

View file

@ -57,7 +57,7 @@ func __lspace(sp unsafe.Pointer, nb int, off int) (ret int)
//go:nosplit //go:nosplit
//go:noescape //go:noescape
//goland:noinspection GoUnusedParameter //goland:noinspection GoUnusedParameter
func __value(s unsafe.Pointer, n int, p int, v *types.JsonState) (ret int) func __value(s unsafe.Pointer, n int, p int, v *types.JsonState, allow_control int) (ret int)
//go:nosplit //go:nosplit
//go:noescape //go:noescape

View file

@ -953,9 +953,9 @@ LBB5_5:
INCL DX INCL DX
MOVL $348, CX MOVL $348, CX
MOVQ CX, -64(BP) MOVQ CX, -64(BP)
LONG $0x940d8d48; WORD $0x0034; BYTE $0x00 // leaq $13460(%rip), %rcx /* _TabPowE(%rip) */ LONG $0x150d8d48; WORD $0x0035; BYTE $0x00 // leaq $13589(%rip), %rcx /* _TabPowE(%rip) */
MOVBLSX 0(CX)(DX*2), SI MOVBLSX 0(CX)(DX*2), SI
LONG $0x370d8d48; WORD $0x0035; BYTE $0x00 // leaq $13623(%rip), %rcx /* _TabPowF(%rip) */ LONG $0xb80d8d48; WORD $0x0035; BYTE $0x00 // leaq $13752(%rip), %rcx /* _TabPowF(%rip) */
MOVQ 0(CX)(DX*8), R8 MOVQ 0(CX)(DX*8), R8
BSRQ AX, CX BSRQ AX, CX
XORL $63, CX XORL $63, CX
@ -1189,7 +1189,7 @@ LBB5_36:
MOVL SI, CX MOVL SI, CX
NEGL CX NEGL CX
MOVLQSX CX, CX MOVLQSX CX, CX
LONG $0xdd158d48; WORD $0x0034; BYTE $0x00 // leaq $13533(%rip), %rdx /* _TabPow10(%rip) */ LONG $0x5e158d48; WORD $0x0035; BYTE $0x00 // leaq $13662(%rip), %rdx /* _TabPow10(%rip) */
MOVQ -80(BP), DI MOVQ -80(BP), DI
IMULQ 0(DX)(CX*8), DI IMULQ 0(DX)(CX*8), DI
CMPQ R12, DI CMPQ R12, DI
@ -1224,7 +1224,7 @@ LBB5_41:
LBB5_43: LBB5_43:
MOVL SI, CX MOVL SI, CX
LONG $0x73158d48; WORD $0x0034; BYTE $0x00 // leaq $13427(%rip), %rdx /* _TabPow10(%rip) */ LONG $0xf4158d48; WORD $0x0034; BYTE $0x00 // leaq $13556(%rip), %rdx /* _TabPow10(%rip) */
MOVQ 0(DX)(CX*8), DI MOVQ 0(DX)(CX*8), DI
MOVL R10, CX MOVL R10, CX
SHLQ CX, DI SHLQ CX, DI
@ -1606,7 +1606,7 @@ LBB5_105:
JG LBB5_107 JG LBB5_107
ADDL $4, AX ADDL $4, AX
MOVL CX, CX MOVL CX, CX
LONG $0xe2358d48; WORD $0x002f; BYTE $0x00 // leaq $12258(%rip), %rsi /* _Digits(%rip) */ LONG $0x63358d48; WORD $0x0030; BYTE $0x00 // leaq $12387(%rip), %rsi /* _Digits(%rip) */
MOVB 0(SI)(CX*2), DX MOVB 0(SI)(CX*2), DX
ADDQ CX, CX ADDQ CX, CX
MOVB DX, 0(R14) MOVB DX, 0(R14)
@ -1624,7 +1624,7 @@ LBB5_107:
MOVB SI, 0(R14) MOVB SI, 0(R14)
WORD $0xd26b; BYTE $0x64 // imull $100, %edx, %edx WORD $0xd26b; BYTE $0x64 // imull $100, %edx, %edx
SUBL DX, CX SUBL DX, CX
LONG $0xa8358d48; WORD $0x002f; BYTE $0x00 // leaq $12200(%rip), %rsi /* _Digits(%rip) */ LONG $0x29358d48; WORD $0x0030; BYTE $0x00 // leaq $12329(%rip), %rsi /* _Digits(%rip) */
MOVB 0(SI)(CX*2), DX MOVB 0(SI)(CX*2), DX
MOVB 1(SI)(CX*2), CX MOVB 1(SI)(CX*2), CX
MOVB DX, 1(R14) MOVB DX, 1(R14)
@ -1655,7 +1655,7 @@ LBB5_111:
JG LBB5_124 JG LBB5_124
ADDL $2, AX ADDL $2, AX
MOVL DI, DX MOVL DI, DX
LONG $0x51358d48; WORD $0x002f; BYTE $0x00 // leaq $12113(%rip), %rsi /* _Digits(%rip) */ LONG $0xd2358d48; WORD $0x002f; BYTE $0x00 // leaq $12242(%rip), %rsi /* _Digits(%rip) */
MOVB 0(SI)(DX*2), DI MOVB 0(SI)(DX*2), DI
ADDQ DX, DX ADDQ DX, DX
MOVB DI, 0(CX) MOVB DI, 0(CX)
@ -1733,7 +1733,7 @@ LBB5_124:
MOVB SI, 0(CX) MOVB SI, 0(CX)
WORD $0xd26b; BYTE $0x64 // imull $100, %edx, %edx WORD $0xd26b; BYTE $0x64 // imull $100, %edx, %edx
SUBL DX, DI SUBL DX, DI
LONG $0x0c158d48; WORD $0x002e; BYTE $0x00 // leaq $11788(%rip), %rdx /* _Digits(%rip) */ LONG $0x8d158d48; WORD $0x002e; BYTE $0x00 // leaq $11917(%rip), %rdx /* _Digits(%rip) */
MOVB 0(DX)(DI*2), SI MOVB 0(DX)(DI*2), SI
MOVB 1(DX)(DI*2), DX MOVB 1(DX)(DI*2), DX
MOVB SI, 1(CX) MOVB SI, 1(CX)
@ -1844,7 +1844,7 @@ _u64toa:
ADDQ AX, AX ADDQ AX, AX
CMPL SI, $1000 CMPL SI, $1000
JB LBB7_3 JB LBB7_3
LONG $0xd00d8d48; WORD $0x002c; BYTE $0x00 // leaq $11472(%rip), %rcx /* _Digits(%rip) */ LONG $0x510d8d48; WORD $0x002d; BYTE $0x00 // leaq $11601(%rip), %rcx /* _Digits(%rip) */
MOVB 0(DX)(CX*1), CX MOVB 0(DX)(CX*1), CX
MOVB CX, 0(DI) MOVB CX, 0(DI)
MOVL $1, CX MOVL $1, CX
@ -1858,14 +1858,14 @@ LBB7_3:
LBB7_4: LBB7_4:
MOVWLZX DX, DX MOVWLZX DX, DX
ORQ $1, DX ORQ $1, DX
LONG $0xaf358d48; WORD $0x002c; BYTE $0x00 // leaq $11439(%rip), %rsi /* _Digits(%rip) */ LONG $0x30358d48; WORD $0x002d; BYTE $0x00 // leaq $11568(%rip), %rsi /* _Digits(%rip) */
MOVB 0(DX)(SI*1), DX MOVB 0(DX)(SI*1), DX
MOVL CX, SI MOVL CX, SI
INCL CX INCL CX
MOVB DX, 0(DI)(SI*1) MOVB DX, 0(DI)(SI*1)
LBB7_6: LBB7_6:
LONG $0x9e158d48; WORD $0x002c; BYTE $0x00 // leaq $11422(%rip), %rdx /* _Digits(%rip) */ LONG $0x1f158d48; WORD $0x002d; BYTE $0x00 // leaq $11551(%rip), %rdx /* _Digits(%rip) */
MOVB 0(AX)(DX*1), DX MOVB 0(AX)(DX*1), DX
MOVL CX, SI MOVL CX, SI
INCL CX INCL CX
@ -1874,7 +1874,7 @@ LBB7_6:
LBB7_7: LBB7_7:
MOVWLZX AX, AX MOVWLZX AX, AX
ORQ $1, AX ORQ $1, AX
LONG $0x86158d48; WORD $0x002c; BYTE $0x00 // leaq $11398(%rip), %rdx /* _Digits(%rip) */ LONG $0x07158d48; WORD $0x002d; BYTE $0x00 // leaq $11527(%rip), %rdx /* _Digits(%rip) */
MOVB 0(AX)(DX*1), AX MOVB 0(AX)(DX*1), AX
MOVL CX, DX MOVL CX, DX
INCL CX INCL CX
@ -1921,7 +1921,7 @@ LBB7_8:
ADDQ R11, R11 ADDQ R11, R11
CMPL SI, $10000000 CMPL SI, $10000000
JB LBB7_11 JB LBB7_11
LONG $0xef058d48; WORD $0x002b; BYTE $0x00 // leaq $11247(%rip), %rax /* _Digits(%rip) */ LONG $0x70058d48; WORD $0x002c; BYTE $0x00 // leaq $11376(%rip), %rax /* _Digits(%rip) */
MOVB 0(R10)(AX*1), AX MOVB 0(R10)(AX*1), AX
MOVB AX, 0(DI) MOVB AX, 0(DI)
MOVL $1, CX MOVL $1, CX
@ -1935,14 +1935,14 @@ LBB7_11:
LBB7_12: LBB7_12:
MOVL R10, AX MOVL R10, AX
ORQ $1, AX ORQ $1, AX
LONG $0xca358d48; WORD $0x002b; BYTE $0x00 // leaq $11210(%rip), %rsi /* _Digits(%rip) */ LONG $0x4b358d48; WORD $0x002c; BYTE $0x00 // leaq $11339(%rip), %rsi /* _Digits(%rip) */
MOVB 0(AX)(SI*1), AX MOVB 0(AX)(SI*1), AX
MOVL CX, SI MOVL CX, SI
INCL CX INCL CX
MOVB AX, 0(DI)(SI*1) MOVB AX, 0(DI)(SI*1)
LBB7_14: LBB7_14:
LONG $0xb9058d48; WORD $0x002b; BYTE $0x00 // leaq $11193(%rip), %rax /* _Digits(%rip) */ LONG $0x3a058d48; WORD $0x002c; BYTE $0x00 // leaq $11322(%rip), %rax /* _Digits(%rip) */
MOVB 0(R9)(AX*1), AX MOVB 0(R9)(AX*1), AX
MOVL CX, SI MOVL CX, SI
INCL CX INCL CX
@ -1951,7 +1951,7 @@ LBB7_14:
LBB7_15: LBB7_15:
MOVWLZX R9, AX MOVWLZX R9, AX
ORQ $1, AX ORQ $1, AX
LONG $0x9f358d48; WORD $0x002b; BYTE $0x00 // leaq $11167(%rip), %rsi /* _Digits(%rip) */ LONG $0x20358d48; WORD $0x002c; BYTE $0x00 // leaq $11296(%rip), %rsi /* _Digits(%rip) */
MOVB 0(AX)(SI*1), AX MOVB 0(AX)(SI*1), AX
MOVL CX, DX MOVL CX, DX
MOVB AX, 0(DI)(DX*1) MOVB AX, 0(DI)(DX*1)
@ -2033,7 +2033,7 @@ LBB7_16:
MOVL $16, CX MOVL $16, CX
SUBL AX, CX SUBL AX, CX
SHLQ $4, AX SHLQ $4, AX
LONG $0x14158d48; WORD $0x002b; BYTE $0x00 // leaq $11028(%rip), %rdx /* _VecShiftShuffles(%rip) */ LONG $0x95158d48; WORD $0x002b; BYTE $0x00 // leaq $11157(%rip), %rdx /* _VecShiftShuffles(%rip) */
LONG $0x0071e2c4; WORD $0x1004 // vpshufb (%rax,%rdx), %xmm1, %xmm0 LONG $0x0071e2c4; WORD $0x1004 // vpshufb (%rax,%rdx), %xmm1, %xmm0
LONG $0x077ffac5 // vmovdqu %xmm0, (%rdi) LONG $0x077ffac5 // vmovdqu %xmm0, (%rdi)
MOVL CX, AX MOVL CX, AX
@ -2059,7 +2059,7 @@ LBB7_20:
CMPL DX, $99 CMPL DX, $99
JA LBB7_22 JA LBB7_22
MOVL DX, AX MOVL DX, AX
LONG $0xf70d8d48; WORD $0x0029; BYTE $0x00 // leaq $10743(%rip), %rcx /* _Digits(%rip) */ LONG $0x780d8d48; WORD $0x002a; BYTE $0x00 // leaq $10872(%rip), %rcx /* _Digits(%rip) */
MOVB 0(CX)(AX*2), DX MOVB 0(CX)(AX*2), DX
MOVB 1(CX)(AX*2), AX MOVB 1(CX)(AX*2), AX
MOVB DX, 0(DI) MOVB DX, 0(DI)
@ -2084,7 +2084,7 @@ LBB7_22:
WORD $0xc96b; BYTE $0x64 // imull $100, %ecx, %ecx WORD $0xc96b; BYTE $0x64 // imull $100, %ecx, %ecx
SUBL CX, AX SUBL CX, AX
MOVWLZX AX, AX MOVWLZX AX, AX
LONG $0xa60d8d48; WORD $0x0029; BYTE $0x00 // leaq $10662(%rip), %rcx /* _Digits(%rip) */ LONG $0x270d8d48; WORD $0x002a; BYTE $0x00 // leaq $10791(%rip), %rcx /* _Digits(%rip) */
MOVB 0(CX)(AX*2), DX MOVB 0(CX)(AX*2), DX
MOVB 1(CX)(AX*2), AX MOVB 1(CX)(AX*2), AX
MOVB DX, 1(DI) MOVB DX, 1(DI)
@ -2096,7 +2096,7 @@ LBB7_24:
WORD $0xc86b; BYTE $0x64 // imull $100, %eax, %ecx WORD $0xc86b; BYTE $0x64 // imull $100, %eax, %ecx
SUBL CX, DX SUBL CX, DX
MOVWLZX AX, AX MOVWLZX AX, AX
LONG $0x83058d4c; WORD $0x0029; BYTE $0x00 // leaq $10627(%rip), %r8 /* _Digits(%rip) */ LONG $0x04058d4c; WORD $0x002a; BYTE $0x00 // leaq $10756(%rip), %r8 /* _Digits(%rip) */
MOVB 0(R8)(AX*2), CX MOVB 0(R8)(AX*2), CX
MOVB 1(R8)(AX*2), AX MOVB 1(R8)(AX*2), AX
MOVB CX, 0(DI) MOVB CX, 0(DI)
@ -2180,7 +2180,7 @@ _unquote:
MOVQ R8, -56(BP) MOVQ R8, -56(BP)
MOVL R8, R10 MOVL R8, R10
ANDL $1, R10 ANDL $1, R10
LONG $0x91058d4c; WORD $0x0029; BYTE $0x00 // leaq $10641(%rip), %r8 /* __UnquoteTab(%rip) */ LONG $0x12058d4c; WORD $0x002a; BYTE $0x00 // leaq $10770(%rip), %r8 /* __UnquoteTab(%rip) */
QUAD $0xffffffb5056ffac5 // vmovdqu $-75(%rip), %xmm0 /* LCPI8_0(%rip) */ QUAD $0xffffffb5056ffac5 // vmovdqu $-75(%rip), %xmm0 /* LCPI8_0(%rip) */
MOVQ DI, R9 MOVQ DI, R9
MOVQ SI, R14 MOVQ SI, R14
@ -2693,91 +2693,99 @@ _value:
WORD $0x8948; BYTE $0xe5 // movq %rsp, %rbp WORD $0x8948; BYTE $0xe5 // movq %rsp, %rbp
WORD $0x5741 // pushq %r15 WORD $0x5741 // pushq %r15
WORD $0x5641 // pushq %r14 WORD $0x5641 // pushq %r14
WORD $0x5441 // pushq %r12
BYTE $0x53 // pushq %rbx BYTE $0x53 // pushq %rbx
SUBQ $24, SP SUBQ $32, SP
MOVL R8, R12
MOVQ CX, R14 MOVQ CX, R14
MOVQ SI, BX MOVQ SI, BX
MOVQ DI, R15 MOVQ DI, R15
MOVQ DI, -48(BP) MOVQ DI, -56(BP)
MOVQ SI, -40(BP) MOVQ SI, -48(BP)
LONG $0xffe27ae8; BYTE $0xff // callq _lspace LONG $0xffe275e8; BYTE $0xff // callq _lspace
MOVQ AX, -32(BP) MOVQ AX, -40(BP)
CMPQ AX, BX CMPQ AX, BX
JAE LBB9_4 JAE LBB9_4
LEAQ 1(AX), CX LEAQ 1(AX), CX
MOVQ CX, -32(BP) MOVQ CX, -40(BP)
MOVBLSX 0(R15)(AX*1), DX MOVBLSX 0(R15)(AX*1), DX
CMPL DX, $123 CMPL DX, $125
JA LBB9_6 JA LBB9_8
LONG $0xa7358d48; WORD $0x0001; BYTE $0x00 // leaq $423(%rip), %rsi /* LJTI9_0(%rip) */ LONG $0x1b358d48; WORD $0x0002; BYTE $0x00 // leaq $539(%rip), %rsi /* LJTI9_0(%rip) */
MOVLQSX 0(SI)(DX*4), DX MOVLQSX 0(SI)(DX*4), DX
ADDQ SI, DX ADDQ SI, DX
JMP DX JMP DX
LBB9_3: LBB9_3:
MOVQ AX, -32(BP) MOVQ AX, -40(BP)
LEAQ -48(BP), DI LEAQ -56(BP), DI
LEAQ -32(BP), SI LEAQ -40(BP), SI
MOVQ R14, DX MOVQ R14, DX
LONG $0x0008c8e8; BYTE $0x00 // callq _vnumber LONG $0x000944e8; BYTE $0x00 // callq _vnumber
JMP LBB9_5 MOVQ -40(BP), AX
JMP LBB9_7
LBB9_4: LBB9_4:
MOVQ $1, 0(R14) MOVQ AX, CX
LBB9_5: LBB9_5:
MOVQ -32(BP), AX MOVQ $1, 0(R14)
ADDQ $24, SP
BYTE $0x5b // popq %rbx
WORD $0x5e41 // popq %r14
WORD $0x5f41 // popq %r15
BYTE $0x5d // popq %rbp
RET
LBB9_6: LBB9_6:
MOVQ $-2, 0(R14) MOVQ CX, AX
JMP LBB9_5
LBB9_7: LBB9_7:
LEAQ -48(BP), DI ADDQ $32, SP
LEAQ -32(BP), SI BYTE $0x5b // popq %rbx
MOVQ R14, DX WORD $0x5c41 // popq %r12
LONG $0x000359e8; BYTE $0x00 // callq _vstring WORD $0x5e41 // popq %r14
JMP LBB9_5 WORD $0x5f41 // popq %r15
BYTE $0x5d // popq %rbp
RET
LBB9_8: LBB9_8:
LEAQ -4(BX), DX MOVQ $-2, 0(R14)
CMPQ AX, DX JMP LBB9_7
JAE LBB9_19
MOVL 0(R15)(CX*1), DX LBB9_9:
CMPL DX, $1702063201 LEAQ -56(BP), DI
JNE LBB9_21 LEAQ -40(BP), SI
ADDQ $5, AX MOVQ R14, DX
MOVQ AX, -32(BP) LONG $0x0003cde8; BYTE $0x00 // callq _vstring
MOVL $4, AX MOVQ -40(BP), AX
MOVQ AX, 0(R14) JMP LBB9_7
JMP LBB9_5
LBB9_10:
XORL AX, AX
TESTL R12, R12
SETEQ AX
MOVQ $-2, DX
MOVL $11, SI
JMP LBB9_22
LBB9_11: LBB9_11:
XORL AX, AX
TESTL R12, R12
SETEQ AX
MOVQ $-2, DX
MOVL $10, SI
JMP LBB9_22
LBB9_12:
MOVQ $5, 0(R14)
JMP LBB9_6
LBB9_13:
LEAQ -3(BX), CX LEAQ -3(BX), CX
CMPQ AX, CX CMPQ AX, CX
JAE LBB9_20 JAE LBB9_20
MOVL 0(R15)(AX*1), DX MOVL 0(R15)(AX*1), DX
CMPL DX, $1819047278 CMPL DX, $1819047278
JNE LBB9_26 JNE LBB9_28
ADDQ $4, AX ADDQ $4, AX
MOVQ AX, -32(BP) MOVQ AX, -40(BP)
MOVL $2, CX MOVL $2, CX
MOVQ CX, 0(R14) JMP LBB9_35
JMP LBB9_5
LBB9_14:
MOVQ $6, 0(R14)
JMP LBB9_5
LBB9_15:
MOVQ $5, 0(R14)
JMP LBB9_5
LBB9_16: LBB9_16:
LEAQ -3(BX), CX LEAQ -3(BX), CX
@ -2787,63 +2795,79 @@ LBB9_16:
CMPL DX, $1702195828 CMPL DX, $1702195828
JNE LBB9_31 JNE LBB9_31
ADDQ $4, AX ADDQ $4, AX
MOVQ AX, -32(BP) MOVQ AX, -40(BP)
MOVL $3, CX MOVL $3, CX
MOVQ CX, 0(R14) JMP LBB9_35
JMP LBB9_5
LBB9_20:
MOVQ BX, -32(BP)
MOVQ $-1, CX
MOVQ CX, 0(R14)
JMP LBB9_5
LBB9_19: LBB9_19:
MOVQ BX, -32(BP) XORL AX, AX
MOVQ $-1, AX TESTL R12, R12
MOVQ AX, 0(R14) SETEQ AX
JMP LBB9_5 MOVQ $-2, DX
MOVL $13, SI
JMP LBB9_22
LBB9_20:
MOVQ BX, -40(BP)
MOVQ $-1, CX
JMP LBB9_36
LBB9_21: LBB9_21:
MOVQ $-2, AX XORL AX, AX
CMPB DX, $97 TESTL R12, R12
JNE LBB9_25 SETEQ AX
MOVL $1702063201, DX MOVQ $-2, DX
MOVL $12, SI
LBB9_22:
LONG $0xf2440f48 // cmoveq %rdx, %rsi
MOVQ SI, 0(R14)
SUBQ AX, CX
JMP LBB9_6
LBB9_23: LBB9_23:
SHRL $8, DX LEAQ -4(BX), DX
MOVBLSX 1(R15)(CX*1), SI CMPQ AX, DX
INCQ CX JAE LBB9_27
MOVBLZX DX, DI MOVL 0(R15)(CX*1), SI
CMPL DI, SI CMPL SI, $1702063201
JE LBB9_23 JNE LBB9_37
MOVQ CX, -32(BP) ADDQ $5, AX
MOVQ AX, -40(BP)
LBB9_25: MOVL $4, DX
MOVQ AX, 0(R14) MOVQ AX, BX
JMP LBB9_5 JMP LBB9_42
LBB9_26: LBB9_26:
MOVQ AX, -32(BP) MOVQ $6, 0(R14)
MOVQ $-2, CX JMP LBB9_6
CMPB DX, $110
JNE LBB9_30 LBB9_27:
MOVL $1819047278, DX MOVQ BX, -40(BP)
MOVQ $-1, DX
JMP LBB9_42
LBB9_28: LBB9_28:
MOVQ AX, -40(BP)
MOVQ $-2, CX
CMPB DX, $110
JNE LBB9_35
MOVL $1819047278, DX
LBB9_30:
SHRL $8, DX SHRL $8, DX
MOVBLSX 1(R15)(AX*1), SI MOVBLSX 1(R15)(AX*1), SI
INCQ AX INCQ AX
MOVBLZX DX, DI MOVBLZX DX, DI
CMPL DI, SI CMPL DI, SI
JE LBB9_28 JE LBB9_30
JMP LBB9_29 JMP LBB9_34
LBB9_31: LBB9_31:
MOVQ AX, -32(BP) MOVQ AX, -40(BP)
MOVQ $-2, CX MOVQ $-2, CX
CMPB DX, $116 CMPB DX, $116
JNE LBB9_30 JNE LBB9_35
MOVL $1702195828, DX MOVL $1702195828, DX
LBB9_33: LBB9_33:
@ -2854,147 +2878,180 @@ LBB9_33:
CMPL DI, SI CMPL DI, SI
JE LBB9_33 JE LBB9_33
LBB9_29: LBB9_34:
MOVQ AX, -32(BP) MOVQ AX, -40(BP)
LBB9_30: LBB9_35:
MOVQ AX, BX
LBB9_36:
MOVQ CX, 0(R14) MOVQ CX, 0(R14)
JMP LBB9_5 MOVQ BX, AX
JMP LBB9_7
// .set L9_0_set_4, LBB9_4-LJTI9_0 LBB9_37:
// .set L9_0_set_6, LBB9_6-LJTI9_0 MOVQ $-2, DX
// .set L9_0_set_7, LBB9_7-LJTI9_0 CMPB SI, $97
// .set L9_0_set_3, LBB9_3-LJTI9_0 JNE LBB9_41
// .set L9_0_set_15, LBB9_15-LJTI9_0 MOVL $1702063201, AX
LBB9_39:
SHRL $8, AX
MOVBLSX 1(R15)(CX*1), SI
INCQ CX
MOVBLZX AX, DI
CMPL DI, SI
JE LBB9_39
MOVQ CX, -40(BP)
LBB9_41:
MOVQ CX, BX
LBB9_42:
MOVQ DX, 0(R14)
MOVQ BX, AX
JMP LBB9_7
// .set L9_0_set_5, LBB9_5-LJTI9_0
// .set L9_0_set_8, LBB9_8-LJTI9_0 // .set L9_0_set_8, LBB9_8-LJTI9_0
// .set L9_0_set_9, LBB9_9-LJTI9_0
// .set L9_0_set_10, LBB9_10-LJTI9_0
// .set L9_0_set_3, LBB9_3-LJTI9_0
// .set L9_0_set_11, LBB9_11-LJTI9_0 // .set L9_0_set_11, LBB9_11-LJTI9_0
// .set L9_0_set_12, LBB9_12-LJTI9_0
// .set L9_0_set_21, LBB9_21-LJTI9_0
// .set L9_0_set_23, LBB9_23-LJTI9_0
// .set L9_0_set_13, LBB9_13-LJTI9_0
// .set L9_0_set_16, LBB9_16-LJTI9_0 // .set L9_0_set_16, LBB9_16-LJTI9_0
// .set L9_0_set_14, LBB9_14-LJTI9_0 // .set L9_0_set_26, LBB9_26-LJTI9_0
// .set L9_0_set_19, LBB9_19-LJTI9_0
LJTI9_0: LJTI9_0:
LONG $0xfffffe78 // .long L9_0_set_4 LONG $0xfffffe0b // .long L9_0_set_5
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe97 // .long L9_0_set_7 LONG $0xfffffe2b // .long L9_0_set_9
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe41 // .long L9_0_set_10
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe5a // .long L9_0_set_11
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xffffff12 // .long L9_0_set_15 LONG $0xfffffe73 // .long L9_0_set_12
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffef8 // .long L9_0_set_21
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffea9 // .long L9_0_set_8 LONG $0xffffff1b // .long L9_0_set_23
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffed8 // .long L9_0_set_11 LONG $0xfffffe7c // .long L9_0_set_13
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xffffff1e // .long L9_0_set_16 LONG $0xfffffea7 // .long L9_0_set_16
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xffffff06 // .long L9_0_set_14 LONG $0xffffff49 // .long L9_0_set_26
LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffed2 // .long L9_0_set_19
LCPI10_0: LCPI10_0:
QUAD $0x2222222222222222; QUAD $0x2222222222222222 // .space 16, '""""""""""""""""' QUAD $0x2222222222222222; QUAD $0x2222222222222222 // .space 16, '""""""""""""""""'
@ -3015,7 +3072,7 @@ _vstring:
MOVQ R15, SI MOVQ R15, SI
MOVL $34, DX MOVL $34, DX
MOVL $92, CX MOVL $92, CX
LONG $0xffe27de8; BYTE $0xff // callq _strchr2 LONG $0xffe1fce8; BYTE $0xff // callq _strchr2
TESTQ AX, AX TESTQ AX, AX
JS LBB10_1 JS LBB10_1
MOVQ 0(BX), R11 MOVQ 0(BX), R11
@ -4059,7 +4116,7 @@ LBB15_7:
MOVQ 8(BX), SI MOVQ 8(BX), SI
MOVQ 0(R13), DX MOVQ 0(R13), DX
MOVQ R14, DI MOVQ R14, DI
LONG $0xffd2e4e8; BYTE $0xff // callq _lspace LONG $0xffd263e8; BYTE $0xff // callq _lspace
MOVQ AX, CX MOVQ AX, CX
MOVQ AX, 0(R13) MOVQ AX, 0(R13)
CMPQ AX, 8(BX) CMPQ AX, 8(BX)
@ -4560,7 +4617,7 @@ _skip_string:
MOVQ R15, SI MOVQ R15, SI
MOVL $34, DX MOVL $34, DX
MOVL $92, CX MOVL $92, CX
LONG $0xffd09ce8; BYTE $0xff // callq _strchr2 LONG $0xffd01be8; BYTE $0xff // callq _strchr2
TESTQ AX, AX TESTQ AX, AX
JS LBB18_3 JS LBB18_3
MOVQ AX, CX MOVQ AX, CX
@ -6171,7 +6228,7 @@ TEXT ·__skip_array(SB), NOSPLIT, $0 - 32
MOVQ s+0(FP), DI MOVQ s+0(FP), DI
MOVQ p+8(FP), SI MOVQ p+8(FP), SI
MOVQ m+16(FP), DX MOVQ m+16(FP), DX
CALL ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+13958(SB) // _skip_array CALL ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+14087(SB) // _skip_array
MOVQ AX, ret+24(FP) MOVQ AX, ret+24(FP)
RET RET
@ -6179,7 +6236,7 @@ TEXT ·__skip_object(SB), NOSPLIT, $0 - 32
MOVQ s+0(FP), DI MOVQ s+0(FP), DI
MOVQ p+8(FP), SI MOVQ p+8(FP), SI
MOVQ m+16(FP), DX MOVQ m+16(FP), DX
CALL ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+13993(SB) // _skip_object CALL ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+14122(SB) // _skip_object
MOVQ AX, ret+24(FP) MOVQ AX, ret+24(FP)
RET RET
@ -6187,7 +6244,7 @@ TEXT ·__skip_one(SB), NOSPLIT, $0 - 32
MOVQ s+0(FP), DI MOVQ s+0(FP), DI
MOVQ p+8(FP), SI MOVQ p+8(FP), SI
MOVQ m+16(FP), DX MOVQ m+16(FP), DX
CALL ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+12328(SB) // _skip_one CALL ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+12457(SB) // _skip_one
MOVQ AX, ret+24(FP) MOVQ AX, ret+24(FP)
RET RET
@ -6208,39 +6265,40 @@ TEXT ·__unquote(SB), NOSPLIT, $0 - 48
MOVQ AX, ret+40(FP) MOVQ AX, ret+40(FP)
RET RET
TEXT ·__value(SB), NOSPLIT, $0 - 40 TEXT ·__value(SB), NOSPLIT, $0 - 48
MOVQ s+0(FP), DI MOVQ s+0(FP), DI
MOVQ n+8(FP), SI MOVQ n+8(FP), SI
MOVQ p+16(FP), DX MOVQ p+16(FP), DX
MOVQ v+24(FP), CX MOVQ v+24(FP), CX
MOVQ allow_control+32(FP), R8
CALL ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+8460(SB) // _value CALL ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+8460(SB) // _value
MOVQ AX, ret+32(FP) MOVQ AX, ret+40(FP)
RET RET
TEXT ·__vnumber(SB), NOSPLIT, $0 - 24 TEXT ·__vnumber(SB), NOSPLIT, $0 - 24
MOVQ s+0(FP), DI MOVQ s+0(FP), DI
MOVQ p+8(FP), SI MOVQ p+8(FP), SI
MOVQ v+16(FP), DX MOVQ v+16(FP), DX
LEAQ ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+10806(SB), AX // _vnumber LEAQ ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+10935(SB), AX // _vnumber
JMP AX JMP AX
TEXT ·__vsigned(SB), NOSPLIT, $0 - 24 TEXT ·__vsigned(SB), NOSPLIT, $0 - 24
MOVQ s+0(FP), DI MOVQ s+0(FP), DI
MOVQ p+8(FP), SI MOVQ p+8(FP), SI
MOVQ v+16(FP), DX MOVQ v+16(FP), DX
LEAQ ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+11778(SB), AX // _vsigned LEAQ ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+11907(SB), AX // _vsigned
JMP AX JMP AX
TEXT ·__vstring(SB), NOSPLIT, $0 - 24 TEXT ·__vstring(SB), NOSPLIT, $0 - 24
MOVQ s+0(FP), DI MOVQ s+0(FP), DI
MOVQ p+8(FP), SI MOVQ p+8(FP), SI
MOVQ v+16(FP), DX MOVQ v+16(FP), DX
LEAQ ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+9464(SB), AX // _vstring LEAQ ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+9593(SB), AX // _vstring
JMP AX JMP AX
TEXT ·__vunsigned(SB), NOSPLIT, $0 - 24 TEXT ·__vunsigned(SB), NOSPLIT, $0 - 24
MOVQ s+0(FP), DI MOVQ s+0(FP), DI
MOVQ p+8(FP), SI MOVQ p+8(FP), SI
MOVQ v+16(FP), DX MOVQ v+16(FP), DX
LEAQ ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+12055(SB), AX // _vunsigned LEAQ ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+12184(SB), AX // _vunsigned
JMP AX JMP AX

View file

@ -36,7 +36,7 @@ func TestNative_Value(t *testing.T) {
var v types.JsonState var v types.JsonState
s := ` -12345` s := ` -12345`
p := (*rt.GoString)(unsafe.Pointer(&s)) p := (*rt.GoString)(unsafe.Pointer(&s))
x := __value(p.Ptr, p.Len, 0, &v) x := __value(p.Ptr, p.Len, 0, &v, 0)
assert.Equal(t, 9, x) assert.Equal(t, 9, x)
assert.Equal(t, types.V_INTEGER, v.Vt) assert.Equal(t, types.V_INTEGER, v.Vt)
assert.Equal(t, int64(-12345), v.Iv) assert.Equal(t, int64(-12345), v.Iv)

View file

@ -31,7 +31,6 @@ var (
) )
var ( var (
S_value = _subr__value
S_vstring = _subr__vstring S_vstring = _subr__vstring
S_vnumber = _subr__vnumber S_vnumber = _subr__vnumber
S_vsigned = _subr__vsigned S_vsigned = _subr__vsigned

View file

@ -19,16 +19,16 @@ var (
_subr__lquote = **(**uintptr)(unsafe.Pointer(&_func__base)) + 295 _subr__lquote = **(**uintptr)(unsafe.Pointer(&_func__base)) + 295
_subr__lspace = **(**uintptr)(unsafe.Pointer(&_func__base)) + 937 _subr__lspace = **(**uintptr)(unsafe.Pointer(&_func__base)) + 937
_subr__lzero = **(**uintptr)(unsafe.Pointer(&_func__base)) + 0 _subr__lzero = **(**uintptr)(unsafe.Pointer(&_func__base)) + 0
_subr__skip_array = **(**uintptr)(unsafe.Pointer(&_func__base)) + 13958 _subr__skip_array = **(**uintptr)(unsafe.Pointer(&_func__base)) + 14087
_subr__skip_object = **(**uintptr)(unsafe.Pointer(&_func__base)) + 13993 _subr__skip_object = **(**uintptr)(unsafe.Pointer(&_func__base)) + 14122
_subr__skip_one = **(**uintptr)(unsafe.Pointer(&_func__base)) + 12328 _subr__skip_one = **(**uintptr)(unsafe.Pointer(&_func__base)) + 12457
_subr__u64toa = **(**uintptr)(unsafe.Pointer(&_func__base)) + 5637 _subr__u64toa = **(**uintptr)(unsafe.Pointer(&_func__base)) + 5637
_subr__unquote = **(**uintptr)(unsafe.Pointer(&_func__base)) + 6825 _subr__unquote = **(**uintptr)(unsafe.Pointer(&_func__base)) + 6825
_subr__value = **(**uintptr)(unsafe.Pointer(&_func__base)) + 8460 _subr__value = **(**uintptr)(unsafe.Pointer(&_func__base)) + 8460
_subr__vnumber = **(**uintptr)(unsafe.Pointer(&_func__base)) + 10806 _subr__vnumber = **(**uintptr)(unsafe.Pointer(&_func__base)) + 10935
_subr__vsigned = **(**uintptr)(unsafe.Pointer(&_func__base)) + 11778 _subr__vsigned = **(**uintptr)(unsafe.Pointer(&_func__base)) + 11907
_subr__vstring = **(**uintptr)(unsafe.Pointer(&_func__base)) + 9464 _subr__vstring = **(**uintptr)(unsafe.Pointer(&_func__base)) + 9593
_subr__vunsigned = **(**uintptr)(unsafe.Pointer(&_func__base)) + 12055 _subr__vunsigned = **(**uintptr)(unsafe.Pointer(&_func__base)) + 12184
) )
var ( var (

View file

@ -57,7 +57,7 @@ func __lspace(sp unsafe.Pointer, nb int, off int) (ret int)
//go:nosplit //go:nosplit
//go:noescape //go:noescape
//goland:noinspection GoUnusedParameter //goland:noinspection GoUnusedParameter
func __value(s unsafe.Pointer, n int, p int, v *types.JsonState) (ret int) func __value(s unsafe.Pointer, n int, p int, v *types.JsonState, allow_control int) (ret int)
//go:nosplit //go:nosplit
//go:noescape //go:noescape

View file

@ -1084,9 +1084,9 @@ LBB5_5:
INCL DX INCL DX
MOVL $348, CX MOVL $348, CX
MOVQ CX, -64(BP) MOVQ CX, -64(BP)
LONG $0xbc0d8d48; WORD $0x0034; BYTE $0x00 // leaq $13500(%rip), %rcx /* _TabPowE(%rip) */ LONG $0x3d0d8d48; WORD $0x0035; BYTE $0x00 // leaq $13629(%rip), %rcx /* _TabPowE(%rip) */
MOVBLSX 0(CX)(DX*2), SI MOVBLSX 0(CX)(DX*2), SI
LONG $0x5f0d8d48; WORD $0x0035; BYTE $0x00 // leaq $13663(%rip), %rcx /* _TabPowF(%rip) */ LONG $0xe00d8d48; WORD $0x0035; BYTE $0x00 // leaq $13792(%rip), %rcx /* _TabPowF(%rip) */
MOVQ 0(CX)(DX*8), R8 MOVQ 0(CX)(DX*8), R8
BSRQ AX, CX BSRQ AX, CX
XORL $63, CX XORL $63, CX
@ -1320,7 +1320,7 @@ LBB5_36:
MOVL SI, CX MOVL SI, CX
NEGL CX NEGL CX
MOVLQSX CX, CX MOVLQSX CX, CX
LONG $0x05158d48; WORD $0x0035; BYTE $0x00 // leaq $13573(%rip), %rdx /* _TabPow10(%rip) */ LONG $0x86158d48; WORD $0x0035; BYTE $0x00 // leaq $13702(%rip), %rdx /* _TabPow10(%rip) */
MOVQ -80(BP), DI MOVQ -80(BP), DI
IMULQ 0(DX)(CX*8), DI IMULQ 0(DX)(CX*8), DI
CMPQ R12, DI CMPQ R12, DI
@ -1355,7 +1355,7 @@ LBB5_41:
LBB5_43: LBB5_43:
MOVL SI, CX MOVL SI, CX
LONG $0x9b158d48; WORD $0x0034; BYTE $0x00 // leaq $13467(%rip), %rdx /* _TabPow10(%rip) */ LONG $0x1c158d48; WORD $0x0035; BYTE $0x00 // leaq $13596(%rip), %rdx /* _TabPow10(%rip) */
MOVQ 0(DX)(CX*8), DI MOVQ 0(DX)(CX*8), DI
MOVL R10, CX MOVL R10, CX
SHLQ CX, DI SHLQ CX, DI
@ -1737,7 +1737,7 @@ LBB5_105:
JG LBB5_107 JG LBB5_107
ADDL $4, AX ADDL $4, AX
MOVL CX, CX MOVL CX, CX
LONG $0x0a358d48; WORD $0x0030; BYTE $0x00 // leaq $12298(%rip), %rsi /* _Digits(%rip) */ LONG $0x8b358d48; WORD $0x0030; BYTE $0x00 // leaq $12427(%rip), %rsi /* _Digits(%rip) */
MOVB 0(SI)(CX*2), DX MOVB 0(SI)(CX*2), DX
ADDQ CX, CX ADDQ CX, CX
MOVB DX, 0(R14) MOVB DX, 0(R14)
@ -1755,7 +1755,7 @@ LBB5_107:
MOVB SI, 0(R14) MOVB SI, 0(R14)
WORD $0xd26b; BYTE $0x64 // imull $100, %edx, %edx WORD $0xd26b; BYTE $0x64 // imull $100, %edx, %edx
SUBL DX, CX SUBL DX, CX
LONG $0xd0358d48; WORD $0x002f; BYTE $0x00 // leaq $12240(%rip), %rsi /* _Digits(%rip) */ LONG $0x51358d48; WORD $0x0030; BYTE $0x00 // leaq $12369(%rip), %rsi /* _Digits(%rip) */
MOVB 0(SI)(CX*2), DX MOVB 0(SI)(CX*2), DX
MOVB 1(SI)(CX*2), CX MOVB 1(SI)(CX*2), CX
MOVB DX, 1(R14) MOVB DX, 1(R14)
@ -1786,7 +1786,7 @@ LBB5_111:
JG LBB5_124 JG LBB5_124
ADDL $2, AX ADDL $2, AX
MOVL DI, DX MOVL DI, DX
LONG $0x79358d48; WORD $0x002f; BYTE $0x00 // leaq $12153(%rip), %rsi /* _Digits(%rip) */ LONG $0xfa358d48; WORD $0x002f; BYTE $0x00 // leaq $12282(%rip), %rsi /* _Digits(%rip) */
MOVB 0(SI)(DX*2), DI MOVB 0(SI)(DX*2), DI
ADDQ DX, DX ADDQ DX, DX
MOVB DI, 0(CX) MOVB DI, 0(CX)
@ -1864,7 +1864,7 @@ LBB5_124:
MOVB SI, 0(CX) MOVB SI, 0(CX)
WORD $0xd26b; BYTE $0x64 // imull $100, %edx, %edx WORD $0xd26b; BYTE $0x64 // imull $100, %edx, %edx
SUBL DX, DI SUBL DX, DI
LONG $0x34158d48; WORD $0x002e; BYTE $0x00 // leaq $11828(%rip), %rdx /* _Digits(%rip) */ LONG $0xb5158d48; WORD $0x002e; BYTE $0x00 // leaq $11957(%rip), %rdx /* _Digits(%rip) */
MOVB 0(DX)(DI*2), SI MOVB 0(DX)(DI*2), SI
MOVB 1(DX)(DI*2), DX MOVB 1(DX)(DI*2), DX
MOVB SI, 1(CX) MOVB SI, 1(CX)
@ -1975,7 +1975,7 @@ _u64toa:
ADDQ AX, AX ADDQ AX, AX
CMPL SI, $1000 CMPL SI, $1000
JB LBB7_3 JB LBB7_3
LONG $0xf80d8d48; WORD $0x002c; BYTE $0x00 // leaq $11512(%rip), %rcx /* _Digits(%rip) */ LONG $0x790d8d48; WORD $0x002d; BYTE $0x00 // leaq $11641(%rip), %rcx /* _Digits(%rip) */
MOVB 0(DX)(CX*1), CX MOVB 0(DX)(CX*1), CX
MOVB CX, 0(DI) MOVB CX, 0(DI)
MOVL $1, CX MOVL $1, CX
@ -1989,14 +1989,14 @@ LBB7_3:
LBB7_4: LBB7_4:
MOVWLZX DX, DX MOVWLZX DX, DX
ORQ $1, DX ORQ $1, DX
LONG $0xd7358d48; WORD $0x002c; BYTE $0x00 // leaq $11479(%rip), %rsi /* _Digits(%rip) */ LONG $0x58358d48; WORD $0x002d; BYTE $0x00 // leaq $11608(%rip), %rsi /* _Digits(%rip) */
MOVB 0(DX)(SI*1), DX MOVB 0(DX)(SI*1), DX
MOVL CX, SI MOVL CX, SI
INCL CX INCL CX
MOVB DX, 0(DI)(SI*1) MOVB DX, 0(DI)(SI*1)
LBB7_6: LBB7_6:
LONG $0xc6158d48; WORD $0x002c; BYTE $0x00 // leaq $11462(%rip), %rdx /* _Digits(%rip) */ LONG $0x47158d48; WORD $0x002d; BYTE $0x00 // leaq $11591(%rip), %rdx /* _Digits(%rip) */
MOVB 0(AX)(DX*1), DX MOVB 0(AX)(DX*1), DX
MOVL CX, SI MOVL CX, SI
INCL CX INCL CX
@ -2005,7 +2005,7 @@ LBB7_6:
LBB7_7: LBB7_7:
MOVWLZX AX, AX MOVWLZX AX, AX
ORQ $1, AX ORQ $1, AX
LONG $0xae158d48; WORD $0x002c; BYTE $0x00 // leaq $11438(%rip), %rdx /* _Digits(%rip) */ LONG $0x2f158d48; WORD $0x002d; BYTE $0x00 // leaq $11567(%rip), %rdx /* _Digits(%rip) */
MOVB 0(AX)(DX*1), AX MOVB 0(AX)(DX*1), AX
MOVL CX, DX MOVL CX, DX
INCL CX INCL CX
@ -2052,7 +2052,7 @@ LBB7_8:
ADDQ R11, R11 ADDQ R11, R11
CMPL SI, $10000000 CMPL SI, $10000000
JB LBB7_11 JB LBB7_11
LONG $0x17058d48; WORD $0x002c; BYTE $0x00 // leaq $11287(%rip), %rax /* _Digits(%rip) */ LONG $0x98058d48; WORD $0x002c; BYTE $0x00 // leaq $11416(%rip), %rax /* _Digits(%rip) */
MOVB 0(R10)(AX*1), AX MOVB 0(R10)(AX*1), AX
MOVB AX, 0(DI) MOVB AX, 0(DI)
MOVL $1, CX MOVL $1, CX
@ -2066,14 +2066,14 @@ LBB7_11:
LBB7_12: LBB7_12:
MOVL R10, AX MOVL R10, AX
ORQ $1, AX ORQ $1, AX
LONG $0xf2358d48; WORD $0x002b; BYTE $0x00 // leaq $11250(%rip), %rsi /* _Digits(%rip) */ LONG $0x73358d48; WORD $0x002c; BYTE $0x00 // leaq $11379(%rip), %rsi /* _Digits(%rip) */
MOVB 0(AX)(SI*1), AX MOVB 0(AX)(SI*1), AX
MOVL CX, SI MOVL CX, SI
INCL CX INCL CX
MOVB AX, 0(DI)(SI*1) MOVB AX, 0(DI)(SI*1)
LBB7_14: LBB7_14:
LONG $0xe1058d48; WORD $0x002b; BYTE $0x00 // leaq $11233(%rip), %rax /* _Digits(%rip) */ LONG $0x62058d48; WORD $0x002c; BYTE $0x00 // leaq $11362(%rip), %rax /* _Digits(%rip) */
MOVB 0(R9)(AX*1), AX MOVB 0(R9)(AX*1), AX
MOVL CX, SI MOVL CX, SI
INCL CX INCL CX
@ -2082,7 +2082,7 @@ LBB7_14:
LBB7_15: LBB7_15:
MOVWLZX R9, AX MOVWLZX R9, AX
ORQ $1, AX ORQ $1, AX
LONG $0xc7358d48; WORD $0x002b; BYTE $0x00 // leaq $11207(%rip), %rsi /* _Digits(%rip) */ LONG $0x48358d48; WORD $0x002c; BYTE $0x00 // leaq $11336(%rip), %rsi /* _Digits(%rip) */
MOVB 0(AX)(SI*1), AX MOVB 0(AX)(SI*1), AX
MOVL CX, DX MOVL CX, DX
MOVB AX, 0(DI)(DX*1) MOVB AX, 0(DI)(DX*1)
@ -2164,7 +2164,7 @@ LBB7_16:
MOVL $16, CX MOVL $16, CX
SUBL AX, CX SUBL AX, CX
SHLQ $4, AX SHLQ $4, AX
LONG $0x3a158d48; WORD $0x002b; BYTE $0x00 // leaq $11066(%rip), %rdx /* _VecShiftShuffles(%rip) */ LONG $0xbb158d48; WORD $0x002b; BYTE $0x00 // leaq $11195(%rip), %rdx /* _VecShiftShuffles(%rip) */
LONG $0x0071e2c4; WORD $0x1004 // vpshufb (%rax,%rdx), %xmm1, %xmm0 LONG $0x0071e2c4; WORD $0x1004 // vpshufb (%rax,%rdx), %xmm1, %xmm0
LONG $0x077ffac5 // vmovdqu %xmm0, (%rdi) LONG $0x077ffac5 // vmovdqu %xmm0, (%rdi)
MOVL CX, AX MOVL CX, AX
@ -2190,7 +2190,7 @@ LBB7_20:
CMPL DX, $99 CMPL DX, $99
JA LBB7_22 JA LBB7_22
MOVL DX, AX MOVL DX, AX
LONG $0x1d0d8d48; WORD $0x002a; BYTE $0x00 // leaq $10781(%rip), %rcx /* _Digits(%rip) */ LONG $0x9e0d8d48; WORD $0x002a; BYTE $0x00 // leaq $10910(%rip), %rcx /* _Digits(%rip) */
MOVB 0(CX)(AX*2), DX MOVB 0(CX)(AX*2), DX
MOVB 1(CX)(AX*2), AX MOVB 1(CX)(AX*2), AX
MOVB DX, 0(DI) MOVB DX, 0(DI)
@ -2215,7 +2215,7 @@ LBB7_22:
WORD $0xc96b; BYTE $0x64 // imull $100, %ecx, %ecx WORD $0xc96b; BYTE $0x64 // imull $100, %ecx, %ecx
SUBL CX, AX SUBL CX, AX
MOVWLZX AX, AX MOVWLZX AX, AX
LONG $0xcc0d8d48; WORD $0x0029; BYTE $0x00 // leaq $10700(%rip), %rcx /* _Digits(%rip) */ LONG $0x4d0d8d48; WORD $0x002a; BYTE $0x00 // leaq $10829(%rip), %rcx /* _Digits(%rip) */
MOVB 0(CX)(AX*2), DX MOVB 0(CX)(AX*2), DX
MOVB 1(CX)(AX*2), AX MOVB 1(CX)(AX*2), AX
MOVB DX, 1(DI) MOVB DX, 1(DI)
@ -2227,7 +2227,7 @@ LBB7_24:
WORD $0xc86b; BYTE $0x64 // imull $100, %eax, %ecx WORD $0xc86b; BYTE $0x64 // imull $100, %eax, %ecx
SUBL CX, DX SUBL CX, DX
MOVWLZX AX, AX MOVWLZX AX, AX
LONG $0xa9058d4c; WORD $0x0029; BYTE $0x00 // leaq $10665(%rip), %r8 /* _Digits(%rip) */ LONG $0x2a058d4c; WORD $0x002a; BYTE $0x00 // leaq $10794(%rip), %r8 /* _Digits(%rip) */
MOVB 0(R8)(AX*2), CX MOVB 0(R8)(AX*2), CX
MOVB 1(R8)(AX*2), AX MOVB 1(R8)(AX*2), AX
MOVB CX, 0(DI) MOVB CX, 0(DI)
@ -2457,7 +2457,7 @@ LBB8_20:
LBB8_34: LBB8_34:
ADDQ BX, AX ADDQ BX, AX
MOVBLZX -1(R9), CX MOVBLZX -1(R9), CX
LONG $0x131d8d48; WORD $0x0028; BYTE $0x00 // leaq $10259(%rip), %rbx /* __UnquoteTab(%rip) */ LONG $0x941d8d48; WORD $0x0028; BYTE $0x00 // leaq $10388(%rip), %rbx /* __UnquoteTab(%rip) */
MOVB 0(CX)(BX*1), CX MOVB 0(CX)(BX*1), CX
CMPB CX, $-1 CMPB CX, $-1
JE LBB8_38 JE LBB8_38
@ -2864,91 +2864,99 @@ _value:
WORD $0x8948; BYTE $0xe5 // movq %rsp, %rbp WORD $0x8948; BYTE $0xe5 // movq %rsp, %rbp
WORD $0x5741 // pushq %r15 WORD $0x5741 // pushq %r15
WORD $0x5641 // pushq %r14 WORD $0x5641 // pushq %r14
WORD $0x5441 // pushq %r12
BYTE $0x53 // pushq %rbx BYTE $0x53 // pushq %rbx
SUBQ $24, SP SUBQ $32, SP
MOVL R8, R12
MOVQ CX, R14 MOVQ CX, R14
MOVQ SI, BX MOVQ SI, BX
MOVQ DI, R15 MOVQ DI, R15
MOVQ DI, -48(BP) MOVQ DI, -56(BP)
MOVQ SI, -40(BP) MOVQ SI, -48(BP)
LONG $0xffe0e5e8; BYTE $0xff // callq _lspace LONG $0xffe0e0e8; BYTE $0xff // callq _lspace
MOVQ AX, -32(BP) MOVQ AX, -40(BP)
CMPQ AX, BX CMPQ AX, BX
JAE LBB9_4 JAE LBB9_4
LEAQ 1(AX), CX LEAQ 1(AX), CX
MOVQ CX, -32(BP) MOVQ CX, -40(BP)
MOVBLSX 0(R15)(AX*1), DX MOVBLSX 0(R15)(AX*1), DX
CMPL DX, $123 CMPL DX, $125
JA LBB9_6 JA LBB9_8
LONG $0xa7358d48; WORD $0x0001; BYTE $0x00 // leaq $423(%rip), %rsi /* LJTI9_0(%rip) */ LONG $0x1b358d48; WORD $0x0002; BYTE $0x00 // leaq $539(%rip), %rsi /* LJTI9_0(%rip) */
MOVLQSX 0(SI)(DX*4), DX MOVLQSX 0(SI)(DX*4), DX
ADDQ SI, DX ADDQ SI, DX
JMP DX JMP DX
LBB9_3: LBB9_3:
MOVQ AX, -32(BP) MOVQ AX, -40(BP)
LEAQ -48(BP), DI LEAQ -56(BP), DI
LEAQ -32(BP), SI LEAQ -40(BP), SI
MOVQ R14, DX MOVQ R14, DX
LONG $0x0008cae8; BYTE $0x00 // callq _vnumber LONG $0x000946e8; BYTE $0x00 // callq _vnumber
JMP LBB9_5 MOVQ -40(BP), AX
JMP LBB9_7
LBB9_4: LBB9_4:
MOVQ $1, 0(R14) MOVQ AX, CX
LBB9_5: LBB9_5:
MOVQ -32(BP), AX MOVQ $1, 0(R14)
ADDQ $24, SP
BYTE $0x5b // popq %rbx
WORD $0x5e41 // popq %r14
WORD $0x5f41 // popq %r15
BYTE $0x5d // popq %rbp
RET
LBB9_6: LBB9_6:
MOVQ $-2, 0(R14) MOVQ CX, AX
JMP LBB9_5
LBB9_7: LBB9_7:
LEAQ -48(BP), DI ADDQ $32, SP
LEAQ -32(BP), SI BYTE $0x5b // popq %rbx
MOVQ R14, DX WORD $0x5c41 // popq %r12
LONG $0x000369e8; BYTE $0x00 // callq _vstring WORD $0x5e41 // popq %r14
JMP LBB9_5 WORD $0x5f41 // popq %r15
BYTE $0x5d // popq %rbp
RET
LBB9_8: LBB9_8:
LEAQ -4(BX), DX MOVQ $-2, 0(R14)
CMPQ AX, DX JMP LBB9_7
JAE LBB9_19
MOVL 0(R15)(CX*1), DX LBB9_9:
CMPL DX, $1702063201 LEAQ -56(BP), DI
JNE LBB9_21 LEAQ -40(BP), SI
ADDQ $5, AX MOVQ R14, DX
MOVQ AX, -32(BP) LONG $0x0003dde8; BYTE $0x00 // callq _vstring
MOVL $4, AX MOVQ -40(BP), AX
MOVQ AX, 0(R14) JMP LBB9_7
JMP LBB9_5
LBB9_10:
XORL AX, AX
TESTL R12, R12
SETEQ AX
MOVQ $-2, DX
MOVL $11, SI
JMP LBB9_22
LBB9_11: LBB9_11:
XORL AX, AX
TESTL R12, R12
SETEQ AX
MOVQ $-2, DX
MOVL $10, SI
JMP LBB9_22
LBB9_12:
MOVQ $5, 0(R14)
JMP LBB9_6
LBB9_13:
LEAQ -3(BX), CX LEAQ -3(BX), CX
CMPQ AX, CX CMPQ AX, CX
JAE LBB9_20 JAE LBB9_20
MOVL 0(R15)(AX*1), DX MOVL 0(R15)(AX*1), DX
CMPL DX, $1819047278 CMPL DX, $1819047278
JNE LBB9_26 JNE LBB9_28
ADDQ $4, AX ADDQ $4, AX
MOVQ AX, -32(BP) MOVQ AX, -40(BP)
MOVL $2, CX MOVL $2, CX
MOVQ CX, 0(R14) JMP LBB9_35
JMP LBB9_5
LBB9_14:
MOVQ $6, 0(R14)
JMP LBB9_5
LBB9_15:
MOVQ $5, 0(R14)
JMP LBB9_5
LBB9_16: LBB9_16:
LEAQ -3(BX), CX LEAQ -3(BX), CX
@ -2958,63 +2966,79 @@ LBB9_16:
CMPL DX, $1702195828 CMPL DX, $1702195828
JNE LBB9_31 JNE LBB9_31
ADDQ $4, AX ADDQ $4, AX
MOVQ AX, -32(BP) MOVQ AX, -40(BP)
MOVL $3, CX MOVL $3, CX
MOVQ CX, 0(R14) JMP LBB9_35
JMP LBB9_5
LBB9_20:
MOVQ BX, -32(BP)
MOVQ $-1, CX
MOVQ CX, 0(R14)
JMP LBB9_5
LBB9_19: LBB9_19:
MOVQ BX, -32(BP) XORL AX, AX
MOVQ $-1, AX TESTL R12, R12
MOVQ AX, 0(R14) SETEQ AX
JMP LBB9_5 MOVQ $-2, DX
MOVL $13, SI
JMP LBB9_22
LBB9_20:
MOVQ BX, -40(BP)
MOVQ $-1, CX
JMP LBB9_36
LBB9_21: LBB9_21:
MOVQ $-2, AX XORL AX, AX
CMPB DX, $97 TESTL R12, R12
JNE LBB9_25 SETEQ AX
MOVL $1702063201, DX MOVQ $-2, DX
MOVL $12, SI
LBB9_22:
LONG $0xf2440f48 // cmoveq %rdx, %rsi
MOVQ SI, 0(R14)
SUBQ AX, CX
JMP LBB9_6
LBB9_23: LBB9_23:
SHRL $8, DX LEAQ -4(BX), DX
MOVBLSX 1(R15)(CX*1), SI CMPQ AX, DX
INCQ CX JAE LBB9_27
MOVBLZX DX, DI MOVL 0(R15)(CX*1), SI
CMPL DI, SI CMPL SI, $1702063201
JE LBB9_23 JNE LBB9_37
MOVQ CX, -32(BP) ADDQ $5, AX
MOVQ AX, -40(BP)
LBB9_25: MOVL $4, DX
MOVQ AX, 0(R14) MOVQ AX, BX
JMP LBB9_5 JMP LBB9_42
LBB9_26: LBB9_26:
MOVQ AX, -32(BP) MOVQ $6, 0(R14)
MOVQ $-2, CX JMP LBB9_6
CMPB DX, $110
JNE LBB9_30 LBB9_27:
MOVL $1819047278, DX MOVQ BX, -40(BP)
MOVQ $-1, DX
JMP LBB9_42
LBB9_28: LBB9_28:
MOVQ AX, -40(BP)
MOVQ $-2, CX
CMPB DX, $110
JNE LBB9_35
MOVL $1819047278, DX
LBB9_30:
SHRL $8, DX SHRL $8, DX
MOVBLSX 1(R15)(AX*1), SI MOVBLSX 1(R15)(AX*1), SI
INCQ AX INCQ AX
MOVBLZX DX, DI MOVBLZX DX, DI
CMPL DI, SI CMPL DI, SI
JE LBB9_28 JE LBB9_30
JMP LBB9_29 JMP LBB9_34
LBB9_31: LBB9_31:
MOVQ AX, -32(BP) MOVQ AX, -40(BP)
MOVQ $-2, CX MOVQ $-2, CX
CMPB DX, $116 CMPB DX, $116
JNE LBB9_30 JNE LBB9_35
MOVL $1702195828, DX MOVL $1702195828, DX
LBB9_33: LBB9_33:
@ -3025,147 +3049,180 @@ LBB9_33:
CMPL DI, SI CMPL DI, SI
JE LBB9_33 JE LBB9_33
LBB9_29: LBB9_34:
MOVQ AX, -32(BP) MOVQ AX, -40(BP)
LBB9_30: LBB9_35:
MOVQ AX, BX
LBB9_36:
MOVQ CX, 0(R14) MOVQ CX, 0(R14)
JMP LBB9_5 MOVQ BX, AX
JMP LBB9_7
// .set L9_0_set_4, LBB9_4-LJTI9_0 LBB9_37:
// .set L9_0_set_6, LBB9_6-LJTI9_0 MOVQ $-2, DX
// .set L9_0_set_7, LBB9_7-LJTI9_0 CMPB SI, $97
// .set L9_0_set_3, LBB9_3-LJTI9_0 JNE LBB9_41
// .set L9_0_set_15, LBB9_15-LJTI9_0 MOVL $1702063201, AX
LBB9_39:
SHRL $8, AX
MOVBLSX 1(R15)(CX*1), SI
INCQ CX
MOVBLZX AX, DI
CMPL DI, SI
JE LBB9_39
MOVQ CX, -40(BP)
LBB9_41:
MOVQ CX, BX
LBB9_42:
MOVQ DX, 0(R14)
MOVQ BX, AX
JMP LBB9_7
// .set L9_0_set_5, LBB9_5-LJTI9_0
// .set L9_0_set_8, LBB9_8-LJTI9_0 // .set L9_0_set_8, LBB9_8-LJTI9_0
// .set L9_0_set_9, LBB9_9-LJTI9_0
// .set L9_0_set_10, LBB9_10-LJTI9_0
// .set L9_0_set_3, LBB9_3-LJTI9_0
// .set L9_0_set_11, LBB9_11-LJTI9_0 // .set L9_0_set_11, LBB9_11-LJTI9_0
// .set L9_0_set_12, LBB9_12-LJTI9_0
// .set L9_0_set_21, LBB9_21-LJTI9_0
// .set L9_0_set_23, LBB9_23-LJTI9_0
// .set L9_0_set_13, LBB9_13-LJTI9_0
// .set L9_0_set_16, LBB9_16-LJTI9_0 // .set L9_0_set_16, LBB9_16-LJTI9_0
// .set L9_0_set_14, LBB9_14-LJTI9_0 // .set L9_0_set_26, LBB9_26-LJTI9_0
// .set L9_0_set_19, LBB9_19-LJTI9_0
LJTI9_0: LJTI9_0:
LONG $0xfffffe78 // .long L9_0_set_4 LONG $0xfffffe0b // .long L9_0_set_5
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe97 // .long L9_0_set_7 LONG $0xfffffe2b // .long L9_0_set_9
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe41 // .long L9_0_set_10
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe62 // .long L9_0_set_3 LONG $0xfffffdee // .long L9_0_set_3
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe5a // .long L9_0_set_11
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xffffff12 // .long L9_0_set_15 LONG $0xfffffe73 // .long L9_0_set_12
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffef8 // .long L9_0_set_21
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffea9 // .long L9_0_set_8 LONG $0xffffff1b // .long L9_0_set_23
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffed8 // .long L9_0_set_11 LONG $0xfffffe7c // .long L9_0_set_13
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xffffff1e // .long L9_0_set_16 LONG $0xfffffea7 // .long L9_0_set_16
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffe8e // .long L9_0_set_6 LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xffffff06 // .long L9_0_set_14 LONG $0xffffff49 // .long L9_0_set_26
LONG $0xfffffe22 // .long L9_0_set_8
LONG $0xfffffed2 // .long L9_0_set_19
LCPI10_0: LCPI10_0:
QUAD $0x2222222222222222; QUAD $0x2222222222222222 // .space 16, '""""""""""""""""' QUAD $0x2222222222222222; QUAD $0x2222222222222222 // .space 16, '""""""""""""""""'
@ -3187,7 +3244,7 @@ _vstring:
MOVQ BX, SI MOVQ BX, SI
MOVL $34, DX MOVL $34, DX
MOVL $92, CX MOVL $92, CX
LONG $0xffe15ce8; BYTE $0xff // callq _strchr2 LONG $0xffe0dbe8; BYTE $0xff // callq _strchr2
TESTQ AX, AX TESTQ AX, AX
JS LBB10_4 JS LBB10_4
MOVQ BX, -48(BP) MOVQ BX, -48(BP)
@ -4216,7 +4273,7 @@ LBB15_7:
MOVQ 0(R15), DI MOVQ 0(R15), DI
MOVQ 8(R15), SI MOVQ 8(R15), SI
MOVQ 0(BX), DX MOVQ 0(BX), DX
LONG $0xffd167e8; BYTE $0xff // callq _lspace LONG $0xffd0e6e8; BYTE $0xff // callq _lspace
MOVQ AX, CX MOVQ AX, CX
MOVQ AX, 0(BX) MOVQ AX, 0(BX)
CMPQ AX, 8(R15) CMPQ AX, 8(R15)
@ -4697,7 +4754,7 @@ _skip_string:
MOVQ R15, SI MOVQ R15, SI
MOVL $34, DX MOVL $34, DX
MOVL $92, CX MOVL $92, CX
LONG $0xffcfc6e8; BYTE $0xff // callq _strchr2 LONG $0xffcf45e8; BYTE $0xff // callq _strchr2
TESTQ AX, AX TESTQ AX, AX
JS LBB18_3 JS LBB18_3
MOVQ AX, CX MOVQ AX, CX
@ -6302,7 +6359,7 @@ TEXT ·__skip_array(SB), NOSPLIT, $0 - 32
MOVQ s+0(FP), DI MOVQ s+0(FP), DI
MOVQ p+8(FP), SI MOVQ p+8(FP), SI
MOVQ m+16(FP), DX MOVQ m+16(FP), DX
CALL ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+14619(SB) // _skip_array CALL ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+14748(SB) // _skip_array
MOVQ AX, ret+24(FP) MOVQ AX, ret+24(FP)
RET RET
@ -6310,7 +6367,7 @@ TEXT ·__skip_object(SB), NOSPLIT, $0 - 32
MOVQ s+0(FP), DI MOVQ s+0(FP), DI
MOVQ p+8(FP), SI MOVQ p+8(FP), SI
MOVQ m+16(FP), DX MOVQ m+16(FP), DX
CALL ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+14654(SB) // _skip_object CALL ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+14783(SB) // _skip_object
MOVQ AX, ret+24(FP) MOVQ AX, ret+24(FP)
RET RET
@ -6318,7 +6375,7 @@ TEXT ·__skip_one(SB), NOSPLIT, $0 - 32
MOVQ s+0(FP), DI MOVQ s+0(FP), DI
MOVQ p+8(FP), SI MOVQ p+8(FP), SI
MOVQ m+16(FP), DX MOVQ m+16(FP), DX
CALL ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+13066(SB) // _skip_one CALL ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+13195(SB) // _skip_one
MOVQ AX, ret+24(FP) MOVQ AX, ret+24(FP)
RET RET
@ -6339,39 +6396,40 @@ TEXT ·__unquote(SB), NOSPLIT, $0 - 48
MOVQ AX, ret+40(FP) MOVQ AX, ret+40(FP)
RET RET
TEXT ·__value(SB), NOSPLIT, $0 - 40 TEXT ·__value(SB), NOSPLIT, $0 - 48
MOVQ s+0(FP), DI MOVQ s+0(FP), DI
MOVQ n+8(FP), SI MOVQ n+8(FP), SI
MOVQ p+16(FP), DX MOVQ p+16(FP), DX
MOVQ v+24(FP), CX MOVQ v+24(FP), CX
MOVQ allow_control+32(FP), R8
CALL ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+9196(SB) // _value CALL ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+9196(SB) // _value
MOVQ AX, ret+32(FP) MOVQ AX, ret+40(FP)
RET RET
TEXT ·__vnumber(SB), NOSPLIT, $0 - 24 TEXT ·__vnumber(SB), NOSPLIT, $0 - 24
MOVQ s+0(FP), DI MOVQ s+0(FP), DI
MOVQ p+8(FP), SI MOVQ p+8(FP), SI
MOVQ v+16(FP), DX MOVQ v+16(FP), DX
LEAQ ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+11544(SB), AX // _vnumber LEAQ ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+11673(SB), AX // _vnumber
JMP AX JMP AX
TEXT ·__vsigned(SB), NOSPLIT, $0 - 24 TEXT ·__vsigned(SB), NOSPLIT, $0 - 24
MOVQ s+0(FP), DI MOVQ s+0(FP), DI
MOVQ p+8(FP), SI MOVQ p+8(FP), SI
MOVQ v+16(FP), DX MOVQ v+16(FP), DX
LEAQ ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+12516(SB), AX // _vsigned LEAQ ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+12645(SB), AX // _vsigned
JMP AX JMP AX
TEXT ·__vstring(SB), NOSPLIT, $0 - 24 TEXT ·__vstring(SB), NOSPLIT, $0 - 24
MOVQ s+0(FP), DI MOVQ s+0(FP), DI
MOVQ p+8(FP), SI MOVQ p+8(FP), SI
MOVQ v+16(FP), DX MOVQ v+16(FP), DX
LEAQ ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+10216(SB), AX // _vstring LEAQ ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+10345(SB), AX // _vstring
JMP AX JMP AX
TEXT ·__vunsigned(SB), NOSPLIT, $0 - 24 TEXT ·__vunsigned(SB), NOSPLIT, $0 - 24
MOVQ s+0(FP), DI MOVQ s+0(FP), DI
MOVQ p+8(FP), SI MOVQ p+8(FP), SI
MOVQ v+16(FP), DX MOVQ v+16(FP), DX
LEAQ ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+12793(SB), AX // _vunsigned LEAQ ·___asm2asm_compiled_code__DO_NOT_CALL_THIS_SYMBOL___+12922(SB), AX // _vunsigned
JMP AX JMP AX

View file

@ -36,7 +36,7 @@ func TestNative_Value(t *testing.T) {
var v types.JsonState var v types.JsonState
s := ` -12345` s := ` -12345`
p := (*rt.GoString)(unsafe.Pointer(&s)) p := (*rt.GoString)(unsafe.Pointer(&s))
x := __value(p.Ptr, p.Len, 0, &v) x := __value(p.Ptr, p.Len, 0, &v, 0)
assert.Equal(t, 9, x) assert.Equal(t, 9, x)
assert.Equal(t, types.V_INTEGER, v.Vt) assert.Equal(t, types.V_INTEGER, v.Vt)
assert.Equal(t, int64(-12345), v.Iv) assert.Equal(t, int64(-12345), v.Iv)

View file

@ -31,7 +31,6 @@ var (
) )
var ( var (
S_value = _subr__value
S_vstring = _subr__vstring S_vstring = _subr__vstring
S_vnumber = _subr__vnumber S_vnumber = _subr__vnumber
S_vsigned = _subr__vsigned S_vsigned = _subr__vsigned

View file

@ -19,16 +19,16 @@ var (
_subr__lquote = **(**uintptr)(unsafe.Pointer(&_func__base)) + 376 _subr__lquote = **(**uintptr)(unsafe.Pointer(&_func__base)) + 376
_subr__lspace = **(**uintptr)(unsafe.Pointer(&_func__base)) + 1268 _subr__lspace = **(**uintptr)(unsafe.Pointer(&_func__base)) + 1268
_subr__lzero = **(**uintptr)(unsafe.Pointer(&_func__base)) + 0 _subr__lzero = **(**uintptr)(unsafe.Pointer(&_func__base)) + 0
_subr__skip_array = **(**uintptr)(unsafe.Pointer(&_func__base)) + 14619 _subr__skip_array = **(**uintptr)(unsafe.Pointer(&_func__base)) + 14748
_subr__skip_object = **(**uintptr)(unsafe.Pointer(&_func__base)) + 14654 _subr__skip_object = **(**uintptr)(unsafe.Pointer(&_func__base)) + 14783
_subr__skip_one = **(**uintptr)(unsafe.Pointer(&_func__base)) + 13066 _subr__skip_one = **(**uintptr)(unsafe.Pointer(&_func__base)) + 13195
_subr__u64toa = **(**uintptr)(unsafe.Pointer(&_func__base)) + 6195 _subr__u64toa = **(**uintptr)(unsafe.Pointer(&_func__base)) + 6195
_subr__unquote = **(**uintptr)(unsafe.Pointer(&_func__base)) + 7419 _subr__unquote = **(**uintptr)(unsafe.Pointer(&_func__base)) + 7419
_subr__value = **(**uintptr)(unsafe.Pointer(&_func__base)) + 9196 _subr__value = **(**uintptr)(unsafe.Pointer(&_func__base)) + 9196
_subr__vnumber = **(**uintptr)(unsafe.Pointer(&_func__base)) + 11544 _subr__vnumber = **(**uintptr)(unsafe.Pointer(&_func__base)) + 11673
_subr__vsigned = **(**uintptr)(unsafe.Pointer(&_func__base)) + 12516 _subr__vsigned = **(**uintptr)(unsafe.Pointer(&_func__base)) + 12645
_subr__vstring = **(**uintptr)(unsafe.Pointer(&_func__base)) + 10216 _subr__vstring = **(**uintptr)(unsafe.Pointer(&_func__base)) + 10345
_subr__vunsigned = **(**uintptr)(unsafe.Pointer(&_func__base)) + 12793 _subr__vunsigned = **(**uintptr)(unsafe.Pointer(&_func__base)) + 12922
) )
var ( var (

View file

@ -35,7 +35,6 @@ var (
) )
var ( var (
S_value uintptr
S_vstring uintptr S_vstring uintptr
S_vnumber uintptr S_vnumber uintptr
S_vsigned uintptr S_vsigned uintptr
@ -66,7 +65,7 @@ func Lspace(sp unsafe.Pointer, nb int, off int) int
//go:nosplit //go:nosplit
//go:noescape //go:noescape
//goland:noinspection GoUnusedParameter //goland:noinspection GoUnusedParameter
func Value(s unsafe.Pointer, n int, p int, v *types.JsonState) int func Value(s unsafe.Pointer, n int, p int, v *types.JsonState, allow_control int) int
//go:nosplit //go:nosplit
//go:noescape //go:noescape
@ -85,7 +84,6 @@ func useAVX() {
S_lquote = avx.S_lquote S_lquote = avx.S_lquote
S_lspace = avx.S_lspace S_lspace = avx.S_lspace
S_unquote = avx.S_unquote S_unquote = avx.S_unquote
S_value = avx.S_value
S_vstring = avx.S_vstring S_vstring = avx.S_vstring
S_vnumber = avx.S_vnumber S_vnumber = avx.S_vnumber
S_vsigned = avx.S_vsigned S_vsigned = avx.S_vsigned
@ -102,7 +100,6 @@ func useAVX2() {
S_lquote = avx2.S_lquote S_lquote = avx2.S_lquote
S_lspace = avx2.S_lspace S_lspace = avx2.S_lspace
S_unquote = avx2.S_unquote S_unquote = avx2.S_unquote
S_value = avx2.S_value
S_vstring = avx2.S_vstring S_vstring = avx2.S_vstring
S_vnumber = avx2.S_vnumber S_vnumber = avx2.S_vnumber
S_vsigned = avx2.S_vsigned S_vsigned = avx2.S_vsigned

View file

@ -36,7 +36,7 @@ TEXT ·Lspace(SB), NOSPLIT, $0 - 32
JMP github·combytedancesonicinternalnativeavx2·__lspace(SB) JMP github·combytedancesonicinternalnativeavx2·__lspace(SB)
JMP github·combytedancesonicinternalnativeavx·__lspace(SB) JMP github·combytedancesonicinternalnativeavx·__lspace(SB)
TEXT ·Value(SB), NOSPLIT, $0 - 40 TEXT ·Value(SB), NOSPLIT, $0 - 48
CMPB github·combytedancesonicinternalcpu·HasAVX2(SB), $0 CMPB github·combytedancesonicinternalcpu·HasAVX2(SB), $0
JE 2(PC) JE 2(PC)
JMP github·combytedancesonicinternalnativeavx2·__value(SB) JMP github·combytedancesonicinternalnativeavx2·__value(SB)

View file

@ -55,7 +55,7 @@ func __lspace(sp unsafe.Pointer, nb int, off int) (ret int)
//go:nosplit //go:nosplit
//go:noescape //go:noescape
//goland:noinspection GoUnusedParameter //goland:noinspection GoUnusedParameter
func __value(s unsafe.Pointer, n int, p int, v *types.JsonState) (ret int) func __value(s unsafe.Pointer, n int, p int, v *types.JsonState, allow_control int) (ret int)
//go:nosplit //go:nosplit
//go:noescape //go:noescape

View file

@ -34,7 +34,7 @@ func TestNative_Value(t *testing.T) {
var v types.JsonState var v types.JsonState
s := ` -12345` s := ` -12345`
p := (*rt.GoString)(unsafe.Pointer(&s)) p := (*rt.GoString)(unsafe.Pointer(&s))
x := __value(p.Ptr, p.Len, 0, &v) x := __value(p.Ptr, p.Len, 0, &v, 0)
assert.Equal(t, 9, x) assert.Equal(t, 9, x)
assert.Equal(t, types.V_INTEGER, v.Vt) assert.Equal(t, types.V_INTEGER, v.Vt)
assert.Equal(t, int64(-12345), v.Iv) assert.Equal(t, int64(-12345), v.Iv)

View file

@ -29,7 +29,6 @@ var (
) )
var ( var (
S_value = _subr__value
S_vstring = _subr__vstring S_vstring = _subr__vstring
S_vnumber = _subr__vnumber S_vnumber = _subr__vnumber
S_vsigned = _subr__vsigned S_vsigned = _subr__vsigned

View file

@ -25,16 +25,19 @@ type ParsingError uint
type SearchingError uint type SearchingError uint
const ( const (
V_EOF ValueType = 1 V_EOF ValueType = 1
V_NULL ValueType = 2 V_NULL ValueType = 2
V_TRUE ValueType = 3 V_TRUE ValueType = 3
V_FALSE ValueType = 4 V_FALSE ValueType = 4
V_ARRAY ValueType = 5 V_ARRAY ValueType = 5
V_OBJECT ValueType = 6 V_OBJECT ValueType = 6
V_STRING ValueType = 7 V_STRING ValueType = 7
V_DOUBLE ValueType = 8 V_DOUBLE ValueType = 8
V_INTEGER ValueType = 9 V_INTEGER ValueType = 9
V_MAX V_KEY_SEP ValueType = 10
V_ELEM_SEP ValueType = 11
V_ARRAY_END ValueType = 12
V_OBJECT_END ValueType = 13
) )
const ( const (

46
issue16_test.go Normal file
View file

@ -0,0 +1,46 @@
/*
* Copyright 2021 ByteDance Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package sonic
import (
`io/ioutil`
`testing`
`github.com/stretchr/testify/require`
)
func benchmarkEncodeSonic(b *testing.B, data []byte) {
var xbook = map[string]interface{}{}
if err := Unmarshal(data, &xbook); err != nil {
b.Fatal(err)
}
if _, err := Marshal(&xbook); err != nil {
b.Fatal(err)
}
b.SetBytes(int64(len(data)))
b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
_, _ = Marshal(&xbook)
}
}
func BenchmarkIssue16(b *testing.B) {
data, err := ioutil.ReadFile("testdata/twitterescaped.json")
require.Nil(b, err)
benchmarkEncodeSonic(b, data)
}

View file

@ -30,6 +30,10 @@
#define V_STRING 7 #define V_STRING 7
#define V_DOUBLE 8 #define V_DOUBLE 8
#define V_INTEGER 9 #define V_INTEGER 9
#define V_KEY_SEP 10
#define V_ELEM_SEP 11
#define V_ARRAY_END 12
#define V_OBJECT_END 13
#define F_DBLUNQ (1 << 0) #define F_DBLUNQ (1 << 0)
#define F_UNIREP (1 << 1) #define F_UNIREP (1 << 1)
@ -97,7 +101,7 @@ ssize_t unquote(const char *sp, ssize_t nb, char *dp, ssize_t *ep, uint64_t flag
ssize_t strchr1(const GoString *s, size_t p, char ch); ssize_t strchr1(const GoString *s, size_t p, char ch);
ssize_t strchr2(const GoString *s, size_t p, char c0, char c1); ssize_t strchr2(const GoString *s, size_t p, char c0, char c1);
long value(const char *s, size_t n, long p, JsonState *ret); long value(const char *s, size_t n, long p, JsonState *ret, int allow_control);
void vstring(const GoString *src, long *p, JsonState *ret); void vstring(const GoString *src, long *p, JsonState *ret);
void vnumber(const GoString *src, long *p, JsonState *ret); void vnumber(const GoString *src, long *p, JsonState *ret);
void vsigned(const GoString *src, long *p, JsonState *ret); void vsigned(const GoString *src, long *p, JsonState *ret);

View file

@ -318,7 +318,7 @@ static inline int64_t advance_number(const GoString *src, long *p, long i, JsonS
/** Value Scanning Routines **/ /** Value Scanning Routines **/
long value(const char *s, size_t n, long p, JsonState *ret) { long value(const char *s, size_t n, long p, JsonState *ret, int allow_control) {
long q = p; long q = p;
GoString m = {.buf = s, .len = n}; GoString m = {.buf = s, .len = n};
@ -341,8 +341,12 @@ long value(const char *s, size_t n, long p, JsonState *ret) {
case 'f' : ret->vt = advance_dword(&m, &q, 0, V_FALSE, VS_ALSE) ; return q; case 'f' : ret->vt = advance_dword(&m, &q, 0, V_FALSE, VS_ALSE) ; return q;
case '[' : ret->vt = V_ARRAY ; return q; case '[' : ret->vt = V_ARRAY ; return q;
case '{' : ret->vt = V_OBJECT ; return q; case '{' : ret->vt = V_OBJECT ; return q;
case ':' : ret->vt = allow_control ? V_KEY_SEP : -ERR_INVAL ; return allow_control ? q : q - 1;
case ',' : ret->vt = allow_control ? V_ELEM_SEP : -ERR_INVAL ; return allow_control ? q : q - 1;
case ']' : ret->vt = allow_control ? V_ARRAY_END : -ERR_INVAL ; return allow_control ? q : q - 1;
case '}' : ret->vt = allow_control ? V_OBJECT_END : -ERR_INVAL ; return allow_control ? q : q - 1;
case 0 : ret->vt = V_EOF ; return q; case 0 : ret->vt = V_EOF ; return q;
default : ret->vt = -ERR_INVAL ; return q; default : ret->vt = -ERR_INVAL ; return q - 1;
} }
} }

1
testdata/twitterescaped.json vendored Normal file

File diff suppressed because one or more lines are too long

56
unquote/unquote.go Normal file
View file

@ -0,0 +1,56 @@
/*
* Copyright 2021 ByteDance Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package unquote
import (
`unsafe`
`github.com/bytedance/sonic/internal/native`
`github.com/bytedance/sonic/internal/native/types`
`github.com/bytedance/sonic/internal/rt`
)
func String(s string) (ret string, err types.ParsingError) {
mm := make([]byte, 0, len(s))
err = intoBytesUnsafe(s, &mm)
ret = rt.Mem2Str(mm)
return
}
func IntoBytes(s string, m *[]byte) types.ParsingError {
if cap(*m) < len(s) {
return types.ERR_EOF
} else {
return intoBytesUnsafe(s, m)
}
}
func intoBytesUnsafe(s string, m *[]byte) types.ParsingError {
pos := -1
slv := (*rt.GoSlice)(unsafe.Pointer(m))
str := (*rt.GoString)(unsafe.Pointer(&s))
ret := native.Unquote(str.Ptr, str.Len, slv.Ptr, &pos, 0)
/* check for errors */
if ret < 0 {
return types.ParsingError(-ret)
}
/* update the length */
slv.Len = ret
return 0
}