master
李光春 8 months ago
parent b3963e6e92
commit 7e7d891e9d

@ -8,7 +8,7 @@ require (
github.com/allegro/bigcache/v3 v3.1.0 github.com/allegro/bigcache/v3 v3.1.0
github.com/baidubce/bce-sdk-go v0.9.156 github.com/baidubce/bce-sdk-go v0.9.156
github.com/basgys/goxml2json v1.1.0 github.com/basgys/goxml2json v1.1.0
github.com/bytedance/sonic v1.10.0 github.com/bytedance/sonic v1.10.1
github.com/gin-gonic/gin v1.9.1 github.com/gin-gonic/gin v1.9.1
github.com/go-playground/locales v0.14.1 github.com/go-playground/locales v0.14.1
github.com/go-playground/universal-translator v0.18.1 github.com/go-playground/universal-translator v0.18.1

@ -15,8 +15,8 @@ github.com/bsm/ginkgo/v2 v2.9.5 h1:rtVBYPs3+TC5iLUVOis1B9tjLTup7Cj5IfzosKtvTJ0=
github.com/bsm/gomega v1.26.0 h1:LhQm+AFcgV2M0WyKroMASzAzCAJVpAxQXv4SaI9a69Y= github.com/bsm/gomega v1.26.0 h1:LhQm+AFcgV2M0WyKroMASzAzCAJVpAxQXv4SaI9a69Y=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM= github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM=
github.com/bytedance/sonic v1.10.0 h1:qtNZduETEIWJVIyDl01BeNxur2rW9OwTQ/yBqFRkKEk= github.com/bytedance/sonic v1.10.1 h1:7a1wuFXL1cMy7a3f7/VFcEtriuXQnUBhtoVfOZiaysc=
github.com/bytedance/sonic v1.10.0/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4= github.com/bytedance/sonic v1.10.1/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=

@ -1,5 +1,5 @@
package go_library package go_library
func Version() string { func Version() string {
return "1.0.168" return "1.0.169"
} }

@ -1,13 +1,11 @@
package wechatminiprogram package wechatminiprogram
import ( import (
"bytes"
"context" "context"
"errors" "errors"
"fmt" "fmt"
"github.com/dtapps/go-library/utils/gojson" "github.com/dtapps/go-library/utils/gojson"
"github.com/dtapps/go-library/utils/gorequest" "github.com/dtapps/go-library/utils/gorequest"
"github.com/dtapps/go-library/utils/gostorage"
"net/http" "net/http"
) )
@ -61,8 +59,3 @@ func (resp *WxaGetWxaCodeResult) Check() error {
} }
return errors.New("返回不是二进制图片") return errors.New("返回不是二进制图片")
} }
// Update 上传
func (resp *WxaGetWxaCodeResult) Update(storage *gostorage.AliYun, filePath, fileName string) (gostorage.FileInfo, error) {
return storage.PutObject(bytes.NewReader(resp.Body), filePath, fileName)
}

@ -1,13 +1,11 @@
package wechatminiprogram package wechatminiprogram
import ( import (
"bytes"
"context" "context"
"errors" "errors"
"fmt" "fmt"
"github.com/dtapps/go-library/utils/gojson" "github.com/dtapps/go-library/utils/gojson"
"github.com/dtapps/go-library/utils/gorequest" "github.com/dtapps/go-library/utils/gorequest"
"github.com/dtapps/go-library/utils/gostorage"
"net/http" "net/http"
) )
@ -63,8 +61,3 @@ func (resp *WxaGetWxaCodeUnLimitResult) Check() error {
} }
return errors.New("返回不是二进制图片") return errors.New("返回不是二进制图片")
} }
// Update 上传
func (resp *WxaGetWxaCodeUnLimitResult) Update(storage *gostorage.AliYun, filePath, fileName string) (gostorage.FileInfo, error) {
return storage.PutObject(bytes.NewReader(resp.Body), filePath, fileName)
}

@ -1,12 +1,9 @@
package wechatopen package wechatopen
import ( import (
"bytes"
"context" "context"
"errors"
"github.com/dtapps/go-library/utils/gojson" "github.com/dtapps/go-library/utils/gojson"
"github.com/dtapps/go-library/utils/gorequest" "github.com/dtapps/go-library/utils/gorequest"
"github.com/dtapps/go-library/utils/gostorage"
"net/http" "net/http"
) )
@ -42,15 +39,3 @@ func (c *Client) CgiBinMaterialGetMaterial(ctx context.Context, authorizerAccess
err = gojson.Unmarshal(request.ResponseBody, &response) err = gojson.Unmarshal(request.ResponseBody, &response)
return newCgiBinMaterialGetMaterialResult(response, request.ResponseBody, request), err return newCgiBinMaterialGetMaterialResult(response, request.ResponseBody, request), err
} }
func (cr *CgiBinMaterialGetMaterialResult) SaveImg(db *gostorage.AliYun, fileName, filePath string) error {
if cr.Result.Errcode != 0 {
return errors.New(cr.Result.Errmsg)
}
// 上传
_, err := db.PutObject(bytes.NewReader(cr.Body), filePath, fileName)
if err != nil {
return err
}
return nil
}

@ -1,12 +1,9 @@
package wechatopen package wechatopen
import ( import (
"bytes"
"context" "context"
"fmt"
"github.com/dtapps/go-library/utils/gojson" "github.com/dtapps/go-library/utils/gojson"
"github.com/dtapps/go-library/utils/gorequest" "github.com/dtapps/go-library/utils/gorequest"
"github.com/dtapps/go-library/utils/gostorage"
"net/http" "net/http"
) )
@ -46,15 +43,3 @@ func (c *Client) WxaGetQrcode(ctx context.Context, authorizerAccessToken, path s
} }
return newWxaGetQrcodeResult(response, request.ResponseBody, request), err return newWxaGetQrcodeResult(response, request.ResponseBody, request), err
} }
func (cr *WxaGetQrcodeResult) SaveImg(db *gostorage.AliYun, fileName, filePath string) error {
if cr.Result.Errcode != 0 {
panic(fmt.Sprintf("接口状态错误:%s", cr.Body))
}
// 上传
_, err := db.PutObject(bytes.NewReader(cr.Body), filePath, fileName)
if err != nil {
return err
}
return nil
}

@ -86,7 +86,7 @@ BenchmarkLoadNode_Parallel/Interface()-16 10330 ns/op 1260.7
- [Large](https://github.com/bytedance/sonic/blob/main/testdata/twitter.json) (635KB, 10000+ key, 6 layers) - [Large](https://github.com/bytedance/sonic/blob/main/testdata/twitter.json) (635KB, 10000+ key, 6 layers)
![large benchmarks](./docs/imgs/bench-large.png) ![large benchmarks](./docs/imgs/bench-large.png)
See [bench.sh](https://github.com/bytedance/sonic/blob/main/bench.sh) for benchmark codes. See [bench.sh](https://github.com/bytedance/sonic/blob/main/scripts/bench.sh) for benchmark codes.
## How it works ## How it works
See [INTRODUCTION.md](./docs/INTRODUCTION.md). See [INTRODUCTION.md](./docs/INTRODUCTION.md).

@ -6,7 +6,7 @@
## 依赖 ## 依赖
- Go 1.16~1.20 - Go 1.16~1.21
- Linux / MacOS / Windows需要 Go1.17 以上) - Linux / MacOS / Windows需要 Go1.17 以上)
- Amd64 架构 - Amd64 架构
@ -89,7 +89,7 @@ BenchmarkLoadNode_Parallel/Interface()-16 10330 ns/op 1260.7
- [大型](https://github.com/bytedance/sonic/blob/main/testdata/twitter.json) (635kB, 10000+ 个键, 6 层) - [大型](https://github.com/bytedance/sonic/blob/main/testdata/twitter.json) (635kB, 10000+ 个键, 6 层)
![large benchmarks](./docs/imgs/bench-large.png) ![large benchmarks](./docs/imgs/bench-large.png)
要查看基准测试代码,请参阅 [bench.sh](https://github.com/bytedance/sonic/blob/main/bench.sh) 。 要查看基准测试代码,请参阅 [bench.sh](https://github.com/bytedance/sonic/blob/main/scripts/bench.sh) 。
## 工作原理 ## 工作原理

@ -68,7 +68,11 @@ type Config struct {
// ValidateString indicates decoder and encoder to valid string values: decoder will return errors // ValidateString indicates decoder and encoder to valid string values: decoder will return errors
// when unescaped control chars(\u0000-\u001f) in the string value of JSON. // when unescaped control chars(\u0000-\u001f) in the string value of JSON.
ValidateString bool ValidateString bool
// NoValidateJSONMarshaler indicates that the encoder should not validate the output string
// after encoding the JSONMarshaler to JSON.
NoValidateJSONMarshaler bool
} }
var ( var (
@ -87,6 +91,7 @@ var (
// ConfigFastest is the fastest config of APIs, aiming at speed. // ConfigFastest is the fastest config of APIs, aiming at speed.
ConfigFastest = Config{ ConfigFastest = Config{
NoQuoteTextMarshaler: true, NoQuoteTextMarshaler: true,
NoValidateJSONMarshaler: true,
}.Froze() }.Froze()
) )

@ -21,20 +21,11 @@ import (
`fmt` `fmt`
`strconv` `strconv`
`unsafe` `unsafe`
`reflect`
`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`
) )
const (
_CAP_BITS = 32
_LEN_MASK = 1 << _CAP_BITS - 1
_NODE_SIZE = unsafe.Sizeof(Node{})
_PAIR_SIZE = unsafe.Sizeof(Pair{})
)
const ( const (
_V_NONE types.ValueType = 0 _V_NONE types.ValueType = 0
_V_NODE_BASE types.ValueType = 1 << 5 _V_NODE_BASE types.ValueType = 1 << 5
@ -61,10 +52,6 @@ const (
V_ANY = int(_V_ANY) V_ANY = int(_V_ANY)
) )
var (
byteType = rt.UnpackType(reflect.TypeOf(byte(0)))
)
type Node struct { type Node struct {
t types.ValueType t types.ValueType
l uint l uint
@ -74,8 +61,8 @@ type Node struct {
// UnmarshalJSON is just an adapter to json.Unmarshaler. // UnmarshalJSON is just an adapter to json.Unmarshaler.
// If you want better performance, use Searcher.GetByPath() directly // If you want better performance, use Searcher.GetByPath() directly
func (self *Node) UnmarshalJSON(data []byte) (err error) { func (self *Node) UnmarshalJSON(data []byte) (err error) {
*self, err = NewSearcher(string(data)).GetByPath() *self = NewRaw(string(data))
return return self.Check()
} }
/** Node Type Accessor **/ /** Node Type Accessor **/
@ -143,6 +130,9 @@ func (self *Node) isAny() bool {
// Raw returns json representation of the node, // Raw returns json representation of the node,
func (self *Node) Raw() (string, error) { func (self *Node) Raw() (string, error) {
if self == nil {
return "", ErrNotExist
}
if !self.IsRaw() { if !self.IsRaw() {
buf, err := self.MarshalJSON() buf, err := self.MarshalJSON()
return rt.Mem2Str(buf), err return rt.Mem2Str(buf), err
@ -157,7 +147,7 @@ func (self *Node) checkRaw() error {
if self.IsRaw() { if self.IsRaw() {
self.parseRaw(false) self.parseRaw(false)
} }
return nil return self.Check()
} }
// Bool returns bool value represented by this node, // Bool returns bool value represented by this node,
@ -538,15 +528,18 @@ func (self *Node) Cap() (int, error) {
// //
// If self is V_NONE or V_NULL, it becomes V_OBJECT and sets the node at the key. // If self is V_NONE or V_NULL, it becomes V_OBJECT and sets the node at the key.
func (self *Node) Set(key string, node Node) (bool, error) { func (self *Node) Set(key string, node Node) (bool, error) {
if self != nil && (self.t == _V_NONE || self.t == types.V_NULL) { if err := self.Check(); err != nil {
*self = NewObject([]Pair{{key, node}}) return false, err
return false, nil
} }
if err := node.Check(); err != nil { if err := node.Check(); err != nil {
return false, err return false, err
} }
if self.t == _V_NONE || self.t == types.V_NULL {
*self = NewObject([]Pair{{key, node}})
return false, nil
}
p := self.Get(key) p := self.Get(key)
if !p.Exists() { if !p.Exists() {
@ -575,7 +568,9 @@ func (self *Node) SetAny(key string, val interface{}) (bool, error) {
// Unset RESET the node of given key under object parent, and reports if the key has existed. // Unset RESET the node of given key under object parent, and reports if the key has existed.
// WARN: After conducting `UnsetXX()`, the node's length WON'T change // WARN: After conducting `UnsetXX()`, the node's length WON'T change
func (self *Node) Unset(key string) (bool, error) { func (self *Node) Unset(key string) (bool, error) {
self.must(types.V_OBJECT, "an object") if err := self.should(types.V_OBJECT, "an object"); err != nil {
return false, err
}
p, i := self.skipKey(key) p, i := self.skipKey(key)
if !p.Exists() { if !p.Exists() {
return false, nil return false, nil
@ -591,10 +586,18 @@ func (self *Node) Unset(key string) (bool, error) {
// //
// The index must be within self's children. // The index must be within self's children.
func (self *Node) SetByIndex(index int, node Node) (bool, error) { func (self *Node) SetByIndex(index int, node Node) (bool, error) {
if err := self.Check(); err != nil {
return false, err
}
if err := node.Check(); err != nil { if err := node.Check(); err != nil {
return false, err return false, err
} }
if index == 0 && (self.t == _V_NONE || self.t == types.V_NULL) {
*self = NewArray([]Node{node})
return false, nil
}
p := self.Index(index) p := self.Index(index)
if !p.Exists() { if !p.Exists() {
return false, ErrNotExist return false, ErrNotExist
@ -614,6 +617,10 @@ func (self *Node) SetAnyByIndex(index int, val interface{}) (bool, error) {
// UnsetByIndex remove the node of given index // UnsetByIndex remove the node of given index
// WARN: After conducting `UnsetXX()`, the node's length WON'T change // WARN: After conducting `UnsetXX()`, the node's length WON'T change
func (self *Node) UnsetByIndex(index int) (bool, error) { func (self *Node) UnsetByIndex(index int) (bool, error) {
if err := self.Check(); err != nil {
return false, err
}
var p *Node var p *Node
it := self.itype() it := self.itype()
if it == types.V_ARRAY { if it == types.V_ARRAY {
@ -647,11 +654,17 @@ func (self *Node) UnsetByIndex(index int) (bool, error) {
// //
// If self is V_NONE or V_NULL, it becomes V_ARRAY and sets the node at index 0. // If self is V_NONE or V_NULL, it becomes V_ARRAY and sets the node at index 0.
func (self *Node) Add(node Node) error { func (self *Node) Add(node Node) error {
if err := self.Check(); err != nil {
return err
}
if self != nil && (self.t == _V_NONE || self.t == types.V_NULL) { if self != nil && (self.t == _V_NONE || self.t == types.V_NULL) {
*self = NewArray([]Node{node}) *self = NewArray([]Node{node})
return nil return nil
} }
if err := self.should(types.V_ARRAY, "an array"); err != nil {
return err
}
s, err := self.unsafeArray() s, err := self.unsafeArray()
if err != nil { if err != nil {
return err return err
@ -831,10 +844,8 @@ func (self *Node) MapUseNode() (map[string]Node, error) {
// return self.toGenericObjectUsePair() // return self.toGenericObjectUsePair()
// } // }
//go:nocheckptr
func (self *Node) unsafeMap() (*linkedPairs, error) { func (self *Node) unsafeMap() (*linkedPairs, error) {
if err := self.should(types.V_OBJECT, "an object"); err != nil {
return nil, err
}
if err := self.skipAllKey(); err != nil { if err := self.skipAllKey(); err != nil {
return nil, err return nil, err
} }
@ -846,7 +857,33 @@ func (self *Node) unsafeMap() (*linkedPairs, error) {
// SortKeys sorts children of a V_OBJECT node in ascending key-order. // SortKeys sorts children of a V_OBJECT node in ascending key-order.
// If recurse is true, it recursively sorts children's children as long as a V_OBJECT node is found. // If recurse is true, it recursively sorts children's children as long as a V_OBJECT node is found.
func (self *Node) SortKeys(recurse bool) (err error) { func (self *Node) SortKeys(recurse bool) error {
// check raw node first
if err := self.checkRaw(); err != nil {
return err
}
if self.itype() == types.V_OBJECT {
return self.sortKeys(recurse)
} else {
var err error
err2 := self.ForEach(func(path Sequence, node *Node) bool {
it := node.itype()
if it == types.V_ARRAY || it == types.V_OBJECT {
err = node.SortKeys(recurse)
if err != nil {
return false
}
}
return true
})
if err != nil {
return err
}
return err2
}
}
func (self *Node) sortKeys(recurse bool) (err error) {
ps, err := self.unsafeMap() ps, err := self.unsafeMap()
if err != nil { if err != nil {
return err return err
@ -856,7 +893,7 @@ func (self *Node) SortKeys(recurse bool) (err error) {
var sc Scanner var sc Scanner
sc = func(path Sequence, node *Node) bool { sc = func(path Sequence, node *Node) bool {
if node.itype() == types.V_OBJECT { if node.itype() == types.V_OBJECT {
if err := node.SortKeys(recurse); err != nil { if err := node.sortKeys(recurse); err != nil {
return false return false
} }
} }
@ -867,7 +904,9 @@ func (self *Node) SortKeys(recurse bool) (err error) {
} }
return true return true
} }
self.ForEach(sc) if err := self.ForEach(sc); err != nil {
return err
}
} }
return nil return nil
} }
@ -946,9 +985,6 @@ func (self *Node) ArrayUseNode() ([]Node, error) {
// } // }
func (self *Node) unsafeArray() (*linkedNodes, error) { func (self *Node) unsafeArray() (*linkedNodes, error) {
if err := self.should(types.V_ARRAY, "an array"); err != nil {
return nil, err
}
if err := self.skipAllIndex(); err != nil { if err := self.skipAllIndex(); err != nil {
return nil, err return nil, err
} }
@ -1103,9 +1139,8 @@ func (self *Node) LoadAll() error {
// Load loads the node's children as parsed. // Load loads the node's children as parsed.
// After calling it, only the node itself can be used on concurrency (not include its children) // After calling it, only the node itself can be used on concurrency (not include its children)
func (self *Node) Load() error { func (self *Node) Load() error {
if self.IsRaw() { if err := self.checkRaw(); err != nil {
self.parseRaw(false) return err
return self.Load()
} }
switch self.t { switch self.t {
@ -1120,40 +1155,6 @@ func (self *Node) Load() error {
/**---------------------------------- Internal Helper Methods ----------------------------------**/ /**---------------------------------- Internal Helper Methods ----------------------------------**/
var (
_NODE_TYPE = rt.UnpackEface(Node{}).Type
_PAIR_TYPE = rt.UnpackEface(Pair{}).Type
)
// func (self *Node) setCapAndLen(cap int, len int) {
// if self.t == types.V_ARRAY || self.t == types.V_OBJECT || self.t == _V_ARRAY_LAZY || self.t == _V_OBJECT_LAZY {
// self.l = uint32(len)
// self.c = uint32(cap)
// } else {
// panic("value does not have a length")
// }
// }
func (self *Node) unsafe_next() *Node {
return (*Node)(unsafe.Pointer(uintptr(unsafe.Pointer(self)) + _NODE_SIZE))
}
func (self *Pair) unsafe_next() *Pair {
return (*Pair)(unsafe.Pointer(uintptr(unsafe.Pointer(self)) + _PAIR_SIZE))
}
func (self *Node) must(t types.ValueType, s string) {
if err := self.checkRaw(); err != nil {
panic(err)
}
if err := self.Check(); err != nil {
panic(err)
}
if self.itype() != t {
panic("value cannot be represented as " + s)
}
}
func (self *Node) should(t types.ValueType, s string) error { func (self *Node) should(t types.ValueType, s string) error {
if err := self.checkRaw(); err != nil { if err := self.checkRaw(); err != nil {
return err return err
@ -1463,20 +1464,6 @@ func (self *Node) toGenericObjectUseNode() (map[string]Node, error) {
return out, nil return out, nil
} }
func (self *Node) toGenericObjectUsePair() ([]Pair, error) {
var nb = self.len()
if nb == 0 {
return []Pair{}, nil
}
var s = (*linkedPairs)(self.p)
var out = make([]Pair, nb)
s.ToSlice(out)
/* all done */
return out, nil
}
/**------------------------------------ Factory Methods ------------------------------------**/ /**------------------------------------ Factory Methods ------------------------------------**/
var ( var (

@ -112,10 +112,10 @@ func (self *Decoder) CheckTrailings() error {
func (self *Decoder) Decode(val interface{}) error { func (self *Decoder) Decode(val interface{}) error {
r := bytes.NewBufferString(self.s) r := bytes.NewBufferString(self.s)
dec := json.NewDecoder(r) dec := json.NewDecoder(r)
if (self.f | uint64(OptionUseNumber)) != 0 { if (self.f & uint64(OptionUseNumber)) != 0 {
dec.UseNumber() dec.UseNumber()
} }
if (self.f | uint64(OptionDisableUnknown)) != 0 { if (self.f & uint64(OptionDisableUnknown)) != 0 {
dec.DisallowUnknownFields() dec.DisallowUnknownFields()
} }
return dec.Decode(val) return dec.Decode(val)

@ -59,6 +59,10 @@ const (
// before encoding it into JSON. // before encoding it into JSON.
ValidateString Options = encoder.ValidateString ValidateString Options = encoder.ValidateString
// NoValidateJSONMarshaler indicates that the encoder should not validate the output string
// after encoding the JSONMarshaler to JSON.
NoValidateJSONMarshaler Options = encoder.NoValidateJSONMarshaler
// CompatibleWithStd is used to be compatible with std encoder. // CompatibleWithStd is used to be compatible with std encoder.
CompatibleWithStd Options = encoder.CompatibleWithStd CompatibleWithStd Options = encoder.CompatibleWithStd
) )

@ -41,6 +41,7 @@ const (
bitNoQuoteTextMarshaler bitNoQuoteTextMarshaler
bitNoNullSliceOrMap bitNoNullSliceOrMap
bitValidateString bitValidateString
bitNoValidateJSONMarshaler
// used for recursive compile // used for recursive compile
bitPointerValue = 63 bitPointerValue = 63
@ -72,6 +73,10 @@ const (
// ValidateString indicates that encoder should validate the input string // ValidateString indicates that encoder should validate the input string
// before encoding it into JSON. // before encoding it into JSON.
ValidateString Options = 1 << bitValidateString ValidateString Options = 1 << bitValidateString
// NoValidateJSONMarshaler indicates that the encoder should not validate the output string
// after encoding the JSONMarshaler to JSON.
NoValidateJSONMarshaler Options = 1 << bitNoValidateJSONMarshaler
// CompatibleWithStd is used to be compatible with std encoder. // CompatibleWithStd is used to be compatible with std encoder.
CompatibleWithStd Options = SortMapKeys | EscapeHTML | CompactMarshaler CompatibleWithStd Options = SortMapKeys | EscapeHTML | CompactMarshaler
@ -116,6 +121,15 @@ func (self *Encoder) SetValidateString(f bool) {
} }
} }
// SetNoValidateJSONMarshaler specifies if option NoValidateJSONMarshaler opens
func (self *Encoder) SetNoValidateJSONMarshaler(f bool) {
if f {
self.Opts |= NoValidateJSONMarshaler
} else {
self.Opts &= ^NoValidateJSONMarshaler
}
}
// SetCompactMarshaler specifies if option CompactMarshaler opens // SetCompactMarshaler specifies if option CompactMarshaler opens
func (self *Encoder) SetCompactMarshaler(f bool) { func (self *Encoder) SetCompactMarshaler(f bool) {
if f { if f {

@ -81,7 +81,6 @@ func (self *_Assembler) WriteRecNotAX(i int, ptr obj.Addr, rec obj.Addr, saveDI
self.Emit("MOVQ", ptr, jit.Ptr(_R11, 0)) self.Emit("MOVQ", ptr, jit.Ptr(_R11, 0))
self.Emit("MOVQ", rec, _AX) self.Emit("MOVQ", rec, _AX)
self.Emit("MOVQ", _AX, jit.Ptr(_R11, 8)) self.Emit("MOVQ", _AX, jit.Ptr(_R11, 8))
self.load(_R11)
if saveAX { if saveAX {
self.load(_AX, _R11) self.load(_AX, _R11)
} else { } else {

@ -40,6 +40,7 @@ const (
bitNoQuoteTextMarshaler bitNoQuoteTextMarshaler
bitNoNullSliceOrMap bitNoNullSliceOrMap
bitValidateString bitValidateString
bitNoValidateJSONMarshaler
// used for recursive compile // used for recursive compile
bitPointerValue = 63 bitPointerValue = 63
@ -71,6 +72,10 @@ const (
// ValidateString indicates that encoder should validate the input string // ValidateString indicates that encoder should validate the input string
// before encoding it into JSON. // before encoding it into JSON.
ValidateString Options = 1 << bitValidateString ValidateString Options = 1 << bitValidateString
// NoValidateJSONMarshaler indicates that the encoder should not validate the output string
// after encoding the JSONMarshaler to JSON.
NoValidateJSONMarshaler Options = 1 << bitNoValidateJSONMarshaler
// CompatibleWithStd is used to be compatible with std encoder. // CompatibleWithStd is used to be compatible with std encoder.
CompatibleWithStd Options = SortMapKeys | EscapeHTML | CompactMarshaler CompatibleWithStd Options = SortMapKeys | EscapeHTML | CompactMarshaler
@ -115,6 +120,15 @@ func (self *Encoder) SetValidateString(f bool) {
} }
} }
// SetNoValidateJSONMarshaler specifies if option NoValidateJSONMarshaler opens
func (self *Encoder) SetNoValidateJSONMarshaler(f bool) {
if f {
self.Opts |= NoValidateJSONMarshaler
} else {
self.Opts &= ^NoValidateJSONMarshaler
}
}
// SetCompactMarshaler specifies if option CompactMarshaler opens // SetCompactMarshaler specifies if option CompactMarshaler opens
func (self *Encoder) SetCompactMarshaler(f bool) { func (self *Encoder) SetCompactMarshaler(f bool) {
if f { if f {

@ -93,8 +93,10 @@ func encodeJsonMarshaler(buf *[]byte, val json.Marshaler, opt Options) error {
if opt & CompactMarshaler != 0 { if opt & CompactMarshaler != 0 {
return compact(buf, ret) return compact(buf, ret)
} }
if ok, s := Valid(ret); !ok { if opt & NoValidateJSONMarshaler == 0 {
return error_marshaler(ret, s) if ok, s := Valid(ret); !ok {
return error_marshaler(ret, s)
}
} }
*buf = append(*buf, ret...) *buf = append(*buf, ret...)
return nil return nil

@ -8,111 +8,117 @@ import (
) )
const ( const (
_entry__f32toa = 31136 _entry__f32toa = 31024
_entry__f64toa = 192 _entry__f64toa = 176
_entry__format_significand = 35248 _entry__format_significand = 35808
_entry__format_integer = 3040 _entry__format_integer = 3424
_entry__fsm_exec = 17920 _entry__fsm_exec = 18816
_entry__advance_string = 14320 _entry__advance_string = 15056
_entry__advance_string_default = 36640 _entry__advance_string_default = 37344
_entry__do_skip_number = 20528 _entry__do_skip_number = 21376
_entry__get_by_path = 25680 _entry__get_by_path = 26416
_entry__skip_one_fast = 22160 _entry__skip_one_fast = 22880
_entry__html_escape = 8912 _entry__unescape = 38256
_entry__i64toa = 3472 _entry__unhex16_is = 9632
_entry__u64toa = 3584 _entry__html_escape = 9824
_entry__i64toa = 3856
_entry__u64toa = 4128
_entry__lspace = 16 _entry__lspace = 16
_entry__quote = 4864 _entry__quote = 5552
_entry__skip_array = 17872 _entry__skip_array = 18768
_entry__skip_number = 21792 _entry__skip_number = 22464
_entry__skip_object = 20160 _entry__skip_object = 21008
_entry__skip_one = 21936 _entry__skip_one = 22640
_entry__unquote = 6576 _entry__unquote = 7296
_entry__validate_one = 21984 _entry__validate_one = 22704
_entry__validate_utf8 = 29888 _entry__validate_utf8 = 29728
_entry__validate_utf8_fast = 30560 _entry__validate_utf8_fast = 30416
_entry__value = 12320 _entry__value = 13104
_entry__vnumber = 15648 _entry__vnumber = 16368
_entry__atof_eisel_lemire64 = 10160 _entry__atof_eisel_lemire64 = 11104
_entry__atof_native = 11712 _entry__atof_native = 12496
_entry__decimal_to_f64 = 10528 _entry__decimal_to_f64 = 11504
_entry__right_shift = 36208 _entry__left_shift = 36288
_entry__left_shift = 35712 _entry__right_shift = 36832
_entry__vsigned = 17200 _entry__vsigned = 18016
_entry__vstring = 14144 _entry__vstring = 14880
_entry__vunsigned = 17520 _entry__vunsigned = 18384
) )
const ( const (
_stack__f32toa = 48 _stack__f32toa = 64
_stack__f64toa = 80 _stack__f64toa = 80
_stack__format_significand = 24 _stack__format_significand = 24
_stack__format_integer = 16 _stack__format_integer = 16
_stack__fsm_exec = 168 _stack__fsm_exec = 160
_stack__advance_string = 64 _stack__advance_string = 72
_stack__advance_string_default = 64 _stack__advance_string_default = 56
_stack__do_skip_number = 48 _stack__do_skip_number = 32
_stack__get_by_path = 280 _stack__get_by_path = 280
_stack__skip_one_fast = 176 _stack__skip_one_fast = 176
_stack__html_escape = 72 _stack__unescape = 64
_stack__unhex16_is = 8
_stack__html_escape = 64
_stack__i64toa = 16 _stack__i64toa = 16
_stack__u64toa = 8 _stack__u64toa = 8
_stack__lspace = 8 _stack__lspace = 8
_stack__quote = 56 _stack__quote = 80
_stack__skip_array = 176 _stack__skip_array = 168
_stack__skip_number = 88 _stack__skip_number = 88
_stack__skip_object = 176 _stack__skip_object = 168
_stack__skip_one = 176 _stack__skip_one = 168
_stack__unquote = 88 _stack__unquote = 112
_stack__validate_one = 176 _stack__validate_one = 168
_stack__validate_utf8 = 48 _stack__validate_utf8 = 48
_stack__validate_utf8_fast = 24 _stack__validate_utf8_fast = 24
_stack__value = 328 _stack__value = 352
_stack__vnumber = 240 _stack__vnumber = 264
_stack__atof_eisel_lemire64 = 32 _stack__atof_eisel_lemire64 = 40
_stack__atof_native = 136 _stack__atof_native = 144
_stack__decimal_to_f64 = 80 _stack__decimal_to_f64 = 88
_stack__right_shift = 8 _stack__left_shift = 32
_stack__left_shift = 24 _stack__right_shift = 16
_stack__vsigned = 16 _stack__vsigned = 16
_stack__vstring = 120 _stack__vstring = 128
_stack__vunsigned = 8 _stack__vunsigned = 24
) )
const ( const (
_size__f32toa = 3392 _size__f32toa = 3792
_size__f64toa = 2848 _size__f64toa = 3248
_size__format_significand = 464 _size__format_significand = 480
_size__format_integer = 432 _size__format_integer = 432
_size__fsm_exec = 1692 _size__fsm_exec = 1656
_size__advance_string = 1280 _size__advance_string = 1264
_size__advance_string_default = 944 _size__advance_string_default = 912
_size__do_skip_number = 924 _size__do_skip_number = 876
_size__get_by_path = 4208 _size__get_by_path = 3312
_size__skip_one_fast = 3016 _size__skip_one_fast = 3016
_size__html_escape = 1248 _size__unescape = 704
_size__i64toa = 48 _size__unhex16_is = 128
_size__u64toa = 1232 _size__html_escape = 1280
_size__lspace = 144 _size__i64toa = 272
_size__quote = 1696 _size__u64toa = 1376
_size__lspace = 112
_size__quote = 1728
_size__skip_array = 48 _size__skip_array = 48
_size__skip_number = 144 _size__skip_number = 160
_size__skip_object = 48 _size__skip_object = 48
_size__skip_one = 48 _size__skip_one = 48
_size__unquote = 2272 _size__unquote = 2336
_size__validate_one = 48 _size__validate_one = 48
_size__validate_utf8 = 672 _size__validate_utf8 = 688
_size__validate_utf8_fast = 544 _size__validate_utf8_fast = 560
_size__value = 1316 _size__value = 1268
_size__vnumber = 1552 _size__vnumber = 1648
_size__atof_eisel_lemire64 = 368 _size__atof_eisel_lemire64 = 400
_size__atof_native = 608 _size__atof_native = 608
_size__decimal_to_f64 = 1184 _size__decimal_to_f64 = 992
_size__right_shift = 400 _size__left_shift = 544
_size__left_shift = 496 _size__right_shift = 480
_size__vsigned = 320 _size__vsigned = 368
_size__vstring = 128 _size__vstring = 128
_size__vunsigned = 336 _size__vunsigned = 368
) )
var ( var (
@ -123,14 +129,16 @@ var (
{8, 24}, {8, 24},
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{3350, 48}, {13, 48},
{3351, 40}, {3734, 64},
{3353, 32}, {3738, 48},
{3355, 24}, {3739, 40},
{3357, 16}, {3741, 32},
{3359, 8}, {3743, 24},
{3363, 0}, {3745, 16},
{3385, 48}, {3747, 8},
{3751, 0},
{3781, 64},
} }
_pcsp__f64toa = [][2]uint32{ _pcsp__f64toa = [][2]uint32{
{1, 0}, {1, 0},
@ -140,24 +148,24 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{2788, 56}, {3124, 56},
{2792, 48}, {3128, 48},
{2793, 40}, {3129, 40},
{2795, 32}, {3131, 32},
{2797, 24}, {3133, 24},
{2799, 16}, {3135, 16},
{2801, 8}, {3137, 8},
{2805, 0}, {3141, 0},
{2843, 56}, {3234, 56},
} }
_pcsp__format_significand = [][2]uint32{ _pcsp__format_significand = [][2]uint32{
{1, 0}, {1, 0},
{4, 8}, {4, 8},
{6, 16}, {6, 16},
{452, 24}, {468, 24},
{453, 16}, {469, 16},
{455, 8}, {471, 8},
{457, 0}, {473, 0},
} }
_pcsp__format_integer = [][2]uint32{ _pcsp__format_integer = [][2]uint32{
{1, 0}, {1, 0},
@ -177,15 +185,15 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{1342, 104}, {1317, 88},
{1346, 48}, {1321, 48},
{1347, 40}, {1322, 40},
{1349, 32}, {1324, 32},
{1351, 24}, {1326, 24},
{1353, 16}, {1328, 16},
{1355, 8}, {1330, 8},
{1356, 0}, {1331, 0},
{1692, 104}, {1656, 88},
} }
_pcsp__advance_string = [][2]uint32{ _pcsp__advance_string = [][2]uint32{
{14, 0}, {14, 0},
@ -195,15 +203,15 @@ var (
{24, 32}, {24, 32},
{26, 40}, {26, 40},
{27, 48}, {27, 48},
{557, 56}, {529, 72},
{561, 48}, {533, 48},
{562, 40}, {534, 40},
{564, 32}, {536, 32},
{566, 24}, {538, 24},
{568, 16}, {540, 16},
{570, 8}, {542, 8},
{571, 0}, {543, 0},
{1268, 56}, {1253, 72},
} }
_pcsp__advance_string_default = [][2]uint32{ _pcsp__advance_string_default = [][2]uint32{
{1, 0}, {1, 0},
@ -213,31 +221,27 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{552, 64}, {381, 56},
{556, 48}, {385, 48},
{557, 40}, {386, 40},
{559, 32}, {388, 32},
{561, 24}, {390, 24},
{563, 16}, {392, 16},
{565, 8}, {394, 8},
{566, 0}, {395, 0},
{931, 64}, {911, 56},
} }
_pcsp__do_skip_number = [][2]uint32{ _pcsp__do_skip_number = [][2]uint32{
{1, 0}, {1, 0},
{4, 8}, {4, 8},
{6, 16}, {6, 16},
{8, 24}, {8, 24},
{10, 32}, {739, 32},
{12, 40}, {740, 24},
{849, 48}, {742, 16},
{850, 40}, {744, 8},
{852, 32}, {745, 0},
{854, 24}, {876, 32},
{856, 16},
{858, 8},
{859, 0},
{924, 48},
} }
_pcsp__get_by_path = [][2]uint32{ _pcsp__get_by_path = [][2]uint32{
{1, 0}, {1, 0},
@ -247,15 +251,15 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{4012, 104}, {3262, 104},
{4016, 48}, {3266, 48},
{4017, 40}, {3267, 40},
{4019, 32}, {3269, 32},
{4021, 24}, {3271, 24},
{4023, 16}, {3273, 16},
{4025, 8}, {3275, 8},
{4026, 0}, {3276, 0},
{4194, 104}, {3301, 104},
} }
_pcsp__skip_one_fast = [][2]uint32{ _pcsp__skip_one_fast = [][2]uint32{
{1, 0}, {1, 0},
@ -265,15 +269,44 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{658, 176}, {613, 176},
{659, 168}, {614, 168},
{661, 160}, {616, 160},
{663, 152}, {618, 152},
{665, 144}, {620, 144},
{667, 136}, {622, 136},
{671, 128}, {626, 128},
{3016, 176}, {3016, 176},
} }
_pcsp__unescape = [][2]uint32{
{1, 0},
{4, 8},
{6, 16},
{8, 24},
{10, 32},
{12, 40},
{13, 48},
{246, 56},
{250, 48},
{251, 40},
{253, 32},
{255, 24},
{257, 16},
{259, 8},
{260, 0},
{695, 56},
}
_pcsp__unhex16_is = [][2]uint32{
{1, 0},
{35, 8},
{36, 0},
{62, 8},
{63, 0},
{97, 8},
{98, 0},
{121, 8},
{123, 0},
}
_pcsp__html_escape = [][2]uint32{ _pcsp__html_escape = [][2]uint32{
{1, 0}, {1, 0},
{4, 8}, {4, 8},
@ -282,39 +315,47 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{1224, 72}, {1265, 64},
{1228, 48}, {1269, 48},
{1229, 40}, {1270, 40},
{1231, 32}, {1272, 32},
{1233, 24}, {1274, 24},
{1235, 16}, {1276, 16},
{1237, 8}, {1278, 8},
{1239, 0}, {1280, 0},
} }
_pcsp__i64toa = [][2]uint32{ _pcsp__i64toa = [][2]uint32{
{14, 0}, {1, 0},
{34, 8}, {171, 8},
{36, 0}, {172, 0},
{207, 8},
{208, 0},
{222, 8},
{223, 0},
{247, 8},
{248, 0},
{253, 8},
{259, 0},
} }
_pcsp__u64toa = [][2]uint32{ _pcsp__u64toa = [][2]uint32{
{1, 0}, {13, 0},
{161, 8}, {162, 8},
{162, 0}, {163, 0},
{457, 8}, {175, 8},
{458, 0}, {240, 0},
{756, 8}, {498, 8},
{757, 0}, {499, 0},
{1221, 8}, {519, 8},
{1223, 0}, {592, 0},
{850, 8},
{928, 0},
{1374, 8},
{1376, 0},
} }
_pcsp__lspace = [][2]uint32{ _pcsp__lspace = [][2]uint32{
{1, 0}, {1, 0},
{89, 8}, {85, 8},
{90, 0}, {87, 0},
{103, 8},
{104, 0},
{111, 8},
{113, 0},
} }
_pcsp__quote = [][2]uint32{ _pcsp__quote = [][2]uint32{
{1, 0}, {1, 0},
@ -324,15 +365,15 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{1649, 56}, {1669, 80},
{1653, 48}, {1673, 48},
{1654, 40}, {1674, 40},
{1656, 32}, {1676, 32},
{1658, 24}, {1678, 24},
{1660, 16}, {1680, 16},
{1662, 8}, {1682, 8},
{1663, 0}, {1683, 0},
{1690, 56}, {1718, 80},
} }
_pcsp__skip_array = [][2]uint32{ _pcsp__skip_array = [][2]uint32{
{1, 0}, {1, 0},
@ -345,13 +386,17 @@ var (
{6, 16}, {6, 16},
{8, 24}, {8, 24},
{10, 32}, {10, 32},
{100, 40}, {12, 40},
{101, 32}, {13, 48},
{103, 24}, {107, 56},
{105, 16}, {111, 48},
{107, 8}, {112, 40},
{108, 0}, {114, 32},
{139, 40}, {116, 24},
{118, 16},
{120, 8},
{121, 0},
{145, 56},
} }
_pcsp__skip_object = [][2]uint32{ _pcsp__skip_object = [][2]uint32{
{1, 0}, {1, 0},
@ -360,8 +405,8 @@ var (
} }
_pcsp__skip_one = [][2]uint32{ _pcsp__skip_one = [][2]uint32{
{1, 0}, {1, 0},
{30, 8}, {28, 8},
{36, 0}, {34, 0},
} }
_pcsp__unquote = [][2]uint32{ _pcsp__unquote = [][2]uint32{
{1, 0}, {1, 0},
@ -371,20 +416,20 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{1684, 88}, {1614, 104},
{1688, 48}, {1618, 48},
{1689, 40}, {1619, 40},
{1691, 32}, {1621, 32},
{1693, 24}, {1623, 24},
{1695, 16}, {1625, 16},
{1697, 8}, {1627, 8},
{1698, 0}, {1628, 0},
{2270, 88}, {2329, 104},
} }
_pcsp__validate_one = [][2]uint32{ _pcsp__validate_one = [][2]uint32{
{1, 0}, {1, 0},
{35, 8}, {33, 8},
{41, 0}, {39, 0},
} }
_pcsp__validate_utf8 = [][2]uint32{ _pcsp__validate_utf8 = [][2]uint32{
{1, 0}, {1, 0},
@ -393,14 +438,14 @@ var (
{8, 24}, {8, 24},
{10, 32}, {10, 32},
{11, 40}, {11, 40},
{623, 48}, {639, 48},
{627, 40}, {643, 40},
{628, 32}, {644, 32},
{630, 24}, {646, 24},
{632, 16}, {648, 16},
{634, 8}, {650, 8},
{635, 0}, {651, 0},
{666, 48}, {682, 48},
} }
_pcsp__validate_utf8_fast = [][2]uint32{ _pcsp__validate_utf8_fast = [][2]uint32{
{1, 0}, {1, 0},
@ -423,15 +468,15 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{495, 88}, {439, 88},
{499, 48}, {443, 48},
{500, 40}, {444, 40},
{502, 32}, {446, 32},
{504, 24}, {448, 24},
{506, 16}, {450, 16},
{508, 8}, {452, 8},
{509, 0}, {453, 0},
{1316, 88}, {1268, 88},
} }
_pcsp__vnumber = [][2]uint32{ _pcsp__vnumber = [][2]uint32{
{1, 0}, {1, 0},
@ -441,34 +486,36 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{803, 104}, {150, 120},
{807, 48}, {154, 48},
{808, 40}, {155, 40},
{810, 32}, {157, 32},
{812, 24}, {159, 24},
{814, 16}, {161, 16},
{816, 8}, {163, 8},
{817, 0}, {164, 0},
{1547, 104}, {1638, 120},
} }
_pcsp__atof_eisel_lemire64 = [][2]uint32{ _pcsp__atof_eisel_lemire64 = [][2]uint32{
{1, 0}, {1, 0},
{4, 8}, {4, 8},
{6, 16}, {6, 16},
{8, 24}, {8, 24},
{292, 32}, {10, 32},
{293, 24}, {315, 40},
{295, 16}, {316, 32},
{297, 8}, {318, 24},
{298, 0}, {320, 16},
{362, 32}, {322, 8},
{323, 0},
{387, 40},
} }
_pcsp__atof_native = [][2]uint32{ _pcsp__atof_native = [][2]uint32{
{1, 0}, {1, 0},
{4, 8}, {4, 8},
{587, 56}, {596, 56},
{591, 8}, {600, 8},
{593, 0}, {602, 0},
} }
_pcsp__decimal_to_f64 = [][2]uint32{ _pcsp__decimal_to_f64 = [][2]uint32{
{1, 0}, {1, 0},
@ -478,60 +525,62 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{1144, 56}, {951, 56},
{1148, 48}, {955, 48},
{1149, 40}, {956, 40},
{1151, 32}, {958, 32},
{1153, 24}, {960, 24},
{1155, 16}, {962, 16},
{1157, 8}, {964, 8},
{1158, 0}, {965, 0},
{1169, 56}, {977, 56},
}
_pcsp__right_shift = [][2]uint32{
{1, 0},
{318, 8},
{319, 0},
{387, 8},
{388, 0},
{396, 8},
{398, 0},
} }
_pcsp__left_shift = [][2]uint32{ _pcsp__left_shift = [][2]uint32{
{1, 0}, {1, 0},
{4, 8}, {4, 8},
{6, 16}, {6, 16},
{363, 24}, {8, 24},
{364, 16}, {418, 32},
{366, 8}, {419, 24},
{367, 0}, {421, 16},
{470, 24}, {423, 8},
{471, 16}, {424, 0},
{539, 32},
}
_pcsp__right_shift = [][2]uint32{
{1, 0},
{4, 8},
{452, 16},
{453, 8},
{454, 0},
{462, 16},
{463, 8},
{464, 0},
{472, 16},
{473, 8}, {473, 8},
{474, 0}, {475, 0},
{486, 24},
} }
_pcsp__vsigned = [][2]uint32{ _pcsp__vsigned = [][2]uint32{
{1, 0}, {1, 0},
{4, 8}, {4, 8},
{112, 16}, {113, 16},
{113, 8}, {114, 8},
{114, 0}, {115, 0},
{125, 16}, {126, 16},
{126, 8}, {127, 8},
{127, 0}, {128, 0},
{260, 16}, {278, 16},
{261, 8}, {279, 8},
{262, 0}, {280, 0},
{266, 16}, {284, 16},
{267, 8}, {285, 8},
{268, 0}, {286, 0},
{306, 16}, {340, 16},
{307, 8}, {341, 8},
{308, 0}, {342, 0},
{316, 16}, {353, 16},
{317, 8}, {354, 8},
{319, 0}, {356, 0},
} }
_pcsp__vstring = [][2]uint32{ _pcsp__vstring = [][2]uint32{
{1, 0}, {1, 0},
@ -550,18 +599,32 @@ var (
} }
_pcsp__vunsigned = [][2]uint32{ _pcsp__vunsigned = [][2]uint32{
{1, 0}, {1, 0},
{71, 8}, {4, 8},
{72, 0}, {6, 16},
{83, 8}, {74, 24},
{84, 0}, {75, 16},
{107, 8}, {77, 8},
{108, 0}, {78, 0},
{273, 8}, {89, 24},
{274, 0}, {90, 16},
{312, 8}, {92, 8},
{313, 0}, {93, 0},
{320, 8}, {116, 24},
{322, 0}, {117, 16},
{119, 8},
{120, 0},
{281, 24},
{282, 16},
{284, 8},
{285, 0},
{336, 24},
{337, 16},
{339, 8},
{340, 0},
{348, 24},
{349, 16},
{351, 8},
{353, 0},
} }
) )
@ -577,6 +640,8 @@ var Funcs = []loader.CFunc{
{"_do_skip_number", _entry__do_skip_number, _size__do_skip_number, _stack__do_skip_number, _pcsp__do_skip_number}, {"_do_skip_number", _entry__do_skip_number, _size__do_skip_number, _stack__do_skip_number, _pcsp__do_skip_number},
{"_get_by_path", _entry__get_by_path, _size__get_by_path, _stack__get_by_path, _pcsp__get_by_path}, {"_get_by_path", _entry__get_by_path, _size__get_by_path, _stack__get_by_path, _pcsp__get_by_path},
{"_skip_one_fast", _entry__skip_one_fast, _size__skip_one_fast, _stack__skip_one_fast, _pcsp__skip_one_fast}, {"_skip_one_fast", _entry__skip_one_fast, _size__skip_one_fast, _stack__skip_one_fast, _pcsp__skip_one_fast},
{"_unescape", _entry__unescape, _size__unescape, _stack__unescape, _pcsp__unescape},
{"_unhex16_is", _entry__unhex16_is, _size__unhex16_is, _stack__unhex16_is, _pcsp__unhex16_is},
{"_html_escape", _entry__html_escape, _size__html_escape, _stack__html_escape, _pcsp__html_escape}, {"_html_escape", _entry__html_escape, _size__html_escape, _stack__html_escape, _pcsp__html_escape},
{"_i64toa", _entry__i64toa, _size__i64toa, _stack__i64toa, _pcsp__i64toa}, {"_i64toa", _entry__i64toa, _size__i64toa, _stack__i64toa, _pcsp__i64toa},
{"_u64toa", _entry__u64toa, _size__u64toa, _stack__u64toa, _pcsp__u64toa}, {"_u64toa", _entry__u64toa, _size__u64toa, _stack__u64toa, _pcsp__u64toa},
@ -595,8 +660,8 @@ var Funcs = []loader.CFunc{
{"_atof_eisel_lemire64", _entry__atof_eisel_lemire64, _size__atof_eisel_lemire64, _stack__atof_eisel_lemire64, _pcsp__atof_eisel_lemire64}, {"_atof_eisel_lemire64", _entry__atof_eisel_lemire64, _size__atof_eisel_lemire64, _stack__atof_eisel_lemire64, _pcsp__atof_eisel_lemire64},
{"_atof_native", _entry__atof_native, _size__atof_native, _stack__atof_native, _pcsp__atof_native}, {"_atof_native", _entry__atof_native, _size__atof_native, _stack__atof_native, _pcsp__atof_native},
{"_decimal_to_f64", _entry__decimal_to_f64, _size__decimal_to_f64, _stack__decimal_to_f64, _pcsp__decimal_to_f64}, {"_decimal_to_f64", _entry__decimal_to_f64, _size__decimal_to_f64, _stack__decimal_to_f64, _pcsp__decimal_to_f64},
{"_right_shift", _entry__right_shift, _size__right_shift, _stack__right_shift, _pcsp__right_shift},
{"_left_shift", _entry__left_shift, _size__left_shift, _stack__left_shift, _pcsp__left_shift}, {"_left_shift", _entry__left_shift, _size__left_shift, _stack__left_shift, _pcsp__left_shift},
{"_right_shift", _entry__right_shift, _size__right_shift, _stack__right_shift, _pcsp__right_shift},
{"_vsigned", _entry__vsigned, _size__vsigned, _stack__vsigned, _pcsp__vsigned}, {"_vsigned", _entry__vsigned, _size__vsigned, _stack__vsigned, _pcsp__vsigned},
{"_vstring", _entry__vstring, _size__vstring, _stack__vstring, _pcsp__vstring}, {"_vstring", _entry__vstring, _size__vstring, _stack__vstring, _pcsp__vstring},
{"_vunsigned", _entry__vunsigned, _size__vunsigned, _stack__vunsigned, _pcsp__vunsigned}, {"_vunsigned", _entry__vunsigned, _size__vunsigned, _stack__vunsigned, _pcsp__vunsigned},

File diff suppressed because it is too large Load Diff

@ -8,114 +8,120 @@ import (
) )
const ( const (
_entry__f32toa = 34624 _entry__f32toa = 34640
_entry__f64toa = 320 _entry__f64toa = 368
_entry__format_significand = 38736 _entry__format_significand = 39440
_entry__format_integer = 3168 _entry__format_integer = 3616
_entry__fsm_exec = 21072 _entry__fsm_exec = 22128
_entry__advance_ns = 16928 _entry__advance_ns = 17856
_entry__advance_string = 17664 _entry__advance_string = 18592
_entry__advance_string_default = 40160 _entry__advance_string_default = 41024
_entry__do_skip_number = 23696 _entry__do_skip_number = 24624
_entry__get_by_path = 28864 _entry__get_by_path = 29616
_entry__skip_one_fast = 25936 _entry__skip_one_fast = 26736
_entry__html_escape = 10560 _entry__unescape = 41824
_entry__i64toa = 3600 _entry__unhex16_is = 11376
_entry__u64toa = 3712 _entry__html_escape = 11712
_entry__i64toa = 4048
_entry__u64toa = 4320
_entry__lspace = 64 _entry__lspace = 64
_entry__quote = 5104 _entry__quote = 5872
_entry__skip_array = 21024 _entry__skip_array = 22080
_entry__skip_number = 25392 _entry__skip_number = 26128
_entry__skip_object = 23088 _entry__skip_object = 24048
_entry__skip_one = 25536 _entry__skip_one = 26304
_entry__unquote = 7888 _entry__unquote = 8816
_entry__validate_one = 25584 _entry__validate_one = 26368
_entry__validate_utf8 = 31040 _entry__validate_utf8 = 30960
_entry__validate_utf8_fast = 31984 _entry__validate_utf8_fast = 31920
_entry__value = 15376 _entry__value = 16320
_entry__vnumber = 18800 _entry__vnumber = 19680
_entry__atof_eisel_lemire64 = 12624 _entry__atof_eisel_lemire64 = 13760
_entry__atof_native = 14768 _entry__atof_native = 15712
_entry__decimal_to_f64 = 13056 _entry__decimal_to_f64 = 14240
_entry__right_shift = 39696 _entry__left_shift = 39920
_entry__left_shift = 39200 _entry__right_shift = 40464
_entry__vsigned = 20352 _entry__vsigned = 21328
_entry__vstring = 17424 _entry__vstring = 18352
_entry__vunsigned = 20672 _entry__vunsigned = 21696
) )
const ( const (
_stack__f32toa = 48 _stack__f32toa = 64
_stack__f64toa = 80 _stack__f64toa = 80
_stack__format_significand = 24 _stack__format_significand = 24
_stack__format_integer = 16 _stack__format_integer = 16
_stack__fsm_exec = 144 _stack__fsm_exec = 136
_stack__advance_ns = 8 _stack__advance_ns = 8
_stack__advance_string = 56 _stack__advance_string = 48
_stack__advance_string_default = 48 _stack__advance_string_default = 48
_stack__do_skip_number = 48 _stack__do_skip_number = 40
_stack__get_by_path = 272 _stack__get_by_path = 304
_stack__skip_one_fast = 184 _stack__skip_one_fast = 184
_stack__unescape = 64
_stack__unhex16_is = 8
_stack__html_escape = 72 _stack__html_escape = 72
_stack__i64toa = 16 _stack__i64toa = 16
_stack__u64toa = 8 _stack__u64toa = 8
_stack__lspace = 8 _stack__lspace = 8
_stack__quote = 56 _stack__quote = 72
_stack__skip_array = 152 _stack__skip_array = 144
_stack__skip_number = 88 _stack__skip_number = 96
_stack__skip_object = 152 _stack__skip_object = 144
_stack__skip_one = 152 _stack__skip_one = 144
_stack__unquote = 72 _stack__unquote = 112
_stack__validate_one = 152 _stack__validate_one = 144
_stack__validate_utf8 = 48 _stack__validate_utf8 = 48
_stack__validate_utf8_fast = 176 _stack__validate_utf8_fast = 176
_stack__value = 328 _stack__value = 352
_stack__vnumber = 240 _stack__vnumber = 264
_stack__atof_eisel_lemire64 = 32 _stack__atof_eisel_lemire64 = 40
_stack__atof_native = 136 _stack__atof_native = 144
_stack__decimal_to_f64 = 80 _stack__decimal_to_f64 = 88
_stack__right_shift = 8 _stack__left_shift = 32
_stack__left_shift = 24 _stack__right_shift = 16
_stack__vsigned = 16 _stack__vsigned = 16
_stack__vstring = 112 _stack__vstring = 104
_stack__vunsigned = 8 _stack__vunsigned = 24
) )
const ( const (
_size__f32toa = 3392 _size__f32toa = 3792
_size__f64toa = 2848 _size__f64toa = 3248
_size__format_significand = 464 _size__format_significand = 480
_size__format_integer = 432 _size__format_integer = 432
_size__fsm_exec = 1468 _size__fsm_exec = 1380
_size__advance_ns = 496 _size__advance_ns = 496
_size__advance_string = 1088 _size__advance_string = 1040
_size__advance_string_default = 768 _size__advance_string_default = 800
_size__do_skip_number = 1360 _size__do_skip_number = 1300
_size__get_by_path = 2176 _size__get_by_path = 1344
_size__skip_one_fast = 2428 _size__skip_one_fast = 2360
_size__html_escape = 2064 _size__unescape = 704
_size__i64toa = 48 _size__unhex16_is = 144
_size__u64toa = 1248 _size__html_escape = 2048
_size__lspace = 224 _size__i64toa = 272
_size__quote = 2736 _size__u64toa = 1408
_size__lspace = 256
_size__quote = 2896
_size__skip_array = 48 _size__skip_array = 48
_size__skip_number = 144 _size__skip_number = 160
_size__skip_object = 48 _size__skip_object = 48
_size__skip_one = 48 _size__skip_one = 48
_size__unquote = 2480 _size__unquote = 2560
_size__validate_one = 48 _size__validate_one = 64
_size__validate_utf8 = 672 _size__validate_utf8 = 688
_size__validate_utf8_fast = 2608 _size__validate_utf8_fast = 2672
_size__value = 1004 _size__value = 992
_size__vnumber = 1552 _size__vnumber = 1648
_size__atof_eisel_lemire64 = 368 _size__atof_eisel_lemire64 = 416
_size__atof_native = 608 _size__atof_native = 608
_size__decimal_to_f64 = 1712 _size__decimal_to_f64 = 1472
_size__right_shift = 400 _size__left_shift = 544
_size__left_shift = 496 _size__right_shift = 496
_size__vsigned = 320 _size__vsigned = 368
_size__vstring = 144 _size__vstring = 144
_size__vunsigned = 336 _size__vunsigned = 368
) )
var ( var (
@ -126,14 +132,16 @@ var (
{8, 24}, {8, 24},
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{3350, 48}, {13, 48},
{3351, 40}, {3734, 64},
{3353, 32}, {3738, 48},
{3355, 24}, {3739, 40},
{3357, 16}, {3741, 32},
{3359, 8}, {3743, 24},
{3363, 0}, {3745, 16},
{3385, 48}, {3747, 8},
{3751, 0},
{3781, 64},
} }
_pcsp__f64toa = [][2]uint32{ _pcsp__f64toa = [][2]uint32{
{1, 0}, {1, 0},
@ -143,24 +151,24 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{2788, 56}, {3124, 56},
{2792, 48}, {3128, 48},
{2793, 40}, {3129, 40},
{2795, 32}, {3131, 32},
{2797, 24}, {3133, 24},
{2799, 16}, {3135, 16},
{2801, 8}, {3137, 8},
{2805, 0}, {3141, 0},
{2843, 56}, {3234, 56},
} }
_pcsp__format_significand = [][2]uint32{ _pcsp__format_significand = [][2]uint32{
{1, 0}, {1, 0},
{4, 8}, {4, 8},
{6, 16}, {6, 16},
{452, 24}, {468, 24},
{453, 16}, {469, 16},
{455, 8}, {471, 8},
{457, 0}, {473, 0},
} }
_pcsp__format_integer = [][2]uint32{ _pcsp__format_integer = [][2]uint32{
{1, 0}, {1, 0},
@ -180,22 +188,23 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{1157, 88}, {1017, 88},
{1161, 48}, {1021, 48},
{1162, 40}, {1022, 40},
{1164, 32}, {1024, 32},
{1166, 24}, {1026, 24},
{1168, 16}, {1028, 16},
{1170, 8}, {1030, 8},
{1171, 0}, {1031, 0},
{1468, 88}, {1380, 88},
} }
_pcsp__advance_ns = [][2]uint32{ _pcsp__advance_ns = [][2]uint32{
{1, 0}, {1, 0},
{453, 8}, {442, 8},
{457, 0}, {446, 0},
{481, 8}, {467, 8},
{486, 0}, {471, 0},
{489, 8},
} }
_pcsp__advance_string = [][2]uint32{ _pcsp__advance_string = [][2]uint32{
{14, 0}, {14, 0},
@ -204,16 +213,14 @@ var (
{22, 24}, {22, 24},
{24, 32}, {24, 32},
{26, 40}, {26, 40},
{27, 48}, {396, 48},
{433, 56}, {397, 40},
{437, 48}, {399, 32},
{438, 40}, {401, 24},
{440, 32}, {403, 16},
{442, 24}, {405, 8},
{444, 16}, {409, 0},
{446, 8}, {1031, 48},
{450, 0},
{1078, 56},
} }
_pcsp__advance_string_default = [][2]uint32{ _pcsp__advance_string_default = [][2]uint32{
{1, 0}, {1, 0},
@ -222,14 +229,14 @@ var (
{8, 24}, {8, 24},
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{332, 48}, {314, 48},
{333, 40}, {315, 40},
{335, 32}, {317, 32},
{337, 24}, {319, 24},
{339, 16}, {321, 16},
{341, 8}, {323, 8},
{345, 0}, {327, 0},
{757, 48}, {786, 48},
} }
_pcsp__do_skip_number = [][2]uint32{ _pcsp__do_skip_number = [][2]uint32{
{1, 0}, {1, 0},
@ -237,15 +244,13 @@ var (
{6, 16}, {6, 16},
{8, 24}, {8, 24},
{10, 32}, {10, 32},
{12, 40}, {1253, 40},
{1274, 48}, {1254, 32},
{1275, 40}, {1256, 24},
{1277, 32}, {1258, 16},
{1279, 24}, {1260, 8},
{1281, 16}, {1264, 0},
{1283, 8}, {1300, 40},
{1287, 0},
{1360, 48},
} }
_pcsp__get_by_path = [][2]uint32{ _pcsp__get_by_path = [][2]uint32{
{1, 0}, {1, 0},
@ -255,15 +260,15 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{2049, 88}, {1293, 120},
{2053, 48}, {1297, 48},
{2054, 40}, {1298, 40},
{2056, 32}, {1300, 32},
{2058, 24}, {1302, 24},
{2060, 16}, {1304, 16},
{2062, 8}, {1306, 8},
{2063, 0}, {1307, 0},
{2170, 88}, {1344, 120},
} }
_pcsp__skip_one_fast = [][2]uint32{ _pcsp__skip_one_fast = [][2]uint32{
{1, 0}, {1, 0},
@ -273,14 +278,43 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{418, 176}, {396, 176},
{419, 168}, {397, 168},
{421, 160}, {399, 160},
{423, 152}, {401, 152},
{425, 144}, {403, 144},
{427, 136}, {405, 136},
{431, 128}, {409, 128},
{2428, 176}, {2360, 176},
}
_pcsp__unescape = [][2]uint32{
{1, 0},
{4, 8},
{6, 16},
{8, 24},
{10, 32},
{12, 40},
{13, 48},
{246, 56},
{250, 48},
{251, 40},
{253, 32},
{255, 24},
{257, 16},
{259, 8},
{260, 0},
{695, 56},
}
_pcsp__unhex16_is = [][2]uint32{
{1, 0},
{35, 8},
{36, 0},
{62, 8},
{63, 0},
{97, 8},
{98, 0},
{121, 8},
{123, 0},
} }
_pcsp__html_escape = [][2]uint32{ _pcsp__html_escape = [][2]uint32{
{1, 0}, {1, 0},
@ -290,39 +324,52 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{2045, 72}, {2017, 72},
{2049, 48}, {2021, 48},
{2050, 40}, {2022, 40},
{2052, 32}, {2024, 32},
{2054, 24}, {2026, 24},
{2056, 16}, {2028, 16},
{2058, 8}, {2030, 8},
{2063, 0}, {2035, 0},
} }
_pcsp__i64toa = [][2]uint32{ _pcsp__i64toa = [][2]uint32{
{14, 0}, {1, 0},
{34, 8}, {171, 8},
{36, 0}, {172, 0},
{207, 8},
{208, 0},
{222, 8},
{223, 0},
{247, 8},
{248, 0},
{253, 8},
{259, 0},
} }
_pcsp__u64toa = [][2]uint32{ _pcsp__u64toa = [][2]uint32{
{1, 0}, {13, 0},
{161, 8}, {162, 8},
{162, 0}, {163, 0},
{457, 8}, {175, 8},
{458, 0}, {240, 0},
{758, 8}, {498, 8},
{759, 0}, {499, 0},
{1225, 8}, {519, 8},
{1227, 0}, {592, 0},
{852, 8},
{928, 0},
{1376, 8},
{1378, 0},
} }
_pcsp__lspace = [][2]uint32{ _pcsp__lspace = [][2]uint32{
{1, 0}, {1, 0},
{184, 8}, {186, 8},
{188, 0}, {190, 0},
{204, 8}, {199, 8},
{208, 0}, {203, 0},
{215, 8}, {210, 8},
{220, 0}, {214, 0},
{232, 8},
} }
_pcsp__quote = [][2]uint32{ _pcsp__quote = [][2]uint32{
{1, 0}, {1, 0},
@ -332,15 +379,15 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{2687, 56}, {2828, 72},
{2691, 48}, {2832, 48},
{2692, 40}, {2833, 40},
{2694, 32}, {2835, 32},
{2696, 24}, {2837, 24},
{2698, 16}, {2839, 16},
{2700, 8}, {2841, 8},
{2704, 0}, {2845, 0},
{2731, 56}, {2876, 72},
} }
_pcsp__skip_array = [][2]uint32{ _pcsp__skip_array = [][2]uint32{
{1, 0}, {1, 0},
@ -353,13 +400,17 @@ var (
{6, 16}, {6, 16},
{8, 24}, {8, 24},
{10, 32}, {10, 32},
{100, 40}, {12, 40},
{101, 32}, {13, 48},
{103, 24}, {107, 56},
{105, 16}, {111, 48},
{107, 8}, {112, 40},
{108, 0}, {114, 32},
{139, 40}, {116, 24},
{118, 16},
{120, 8},
{121, 0},
{145, 56},
} }
_pcsp__skip_object = [][2]uint32{ _pcsp__skip_object = [][2]uint32{
{1, 0}, {1, 0},
@ -368,8 +419,8 @@ var (
} }
_pcsp__skip_one = [][2]uint32{ _pcsp__skip_one = [][2]uint32{
{1, 0}, {1, 0},
{30, 8}, {28, 8},
{36, 0}, {34, 0},
} }
_pcsp__unquote = [][2]uint32{ _pcsp__unquote = [][2]uint32{
{1, 0}, {1, 0},
@ -379,20 +430,20 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{79, 72}, {1836, 104},
{83, 48}, {1840, 48},
{84, 40}, {1841, 40},
{86, 32}, {1843, 32},
{88, 24}, {1845, 24},
{90, 16}, {1847, 16},
{92, 8}, {1849, 8},
{96, 0}, {1853, 0},
{2464, 72}, {2554, 104},
} }
_pcsp__validate_one = [][2]uint32{ _pcsp__validate_one = [][2]uint32{
{1, 0}, {1, 0},
{35, 8}, {33, 8},
{41, 0}, {39, 0},
} }
_pcsp__validate_utf8 = [][2]uint32{ _pcsp__validate_utf8 = [][2]uint32{
{1, 0}, {1, 0},
@ -401,26 +452,26 @@ var (
{8, 24}, {8, 24},
{10, 32}, {10, 32},
{11, 40}, {11, 40},
{623, 48}, {639, 48},
{627, 40}, {643, 40},
{628, 32}, {644, 32},
{630, 24}, {646, 24},
{632, 16}, {648, 16},
{634, 8}, {650, 8},
{635, 0}, {651, 0},
{666, 48}, {682, 48},
} }
_pcsp__validate_utf8_fast = [][2]uint32{ _pcsp__validate_utf8_fast = [][2]uint32{
{1, 0}, {1, 0},
{4, 8}, {4, 8},
{5, 16}, {5, 16},
{1738, 176}, {1706, 176},
{1739, 168}, {1707, 168},
{1743, 160}, {1711, 160},
{2018, 176}, {2003, 176},
{2019, 168}, {2004, 168},
{2023, 160}, {2008, 160},
{2600, 176}, {2656, 176},
} }
_pcsp__value = [][2]uint32{ _pcsp__value = [][2]uint32{
{1, 0}, {1, 0},
@ -430,14 +481,14 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{988, 88}, {974, 88},
{992, 48}, {978, 48},
{993, 40}, {979, 40},
{995, 32}, {981, 32},
{997, 24}, {983, 24},
{999, 16}, {985, 16},
{1001, 8}, {987, 8},
{1004, 0}, {992, 0},
} }
_pcsp__vnumber = [][2]uint32{ _pcsp__vnumber = [][2]uint32{
{1, 0}, {1, 0},
@ -447,34 +498,36 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{803, 104}, {150, 120},
{807, 48}, {154, 48},
{808, 40}, {155, 40},
{810, 32}, {157, 32},
{812, 24}, {159, 24},
{814, 16}, {161, 16},
{816, 8}, {163, 8},
{817, 0}, {164, 0},
{1547, 104}, {1638, 120},
} }
_pcsp__atof_eisel_lemire64 = [][2]uint32{ _pcsp__atof_eisel_lemire64 = [][2]uint32{
{1, 0}, {1, 0},
{4, 8}, {4, 8},
{6, 16}, {6, 16},
{8, 24}, {8, 24},
{292, 32}, {10, 32},
{293, 24}, {315, 40},
{295, 16}, {316, 32},
{297, 8}, {318, 24},
{298, 0}, {320, 16},
{362, 32}, {322, 8},
{323, 0},
{387, 40},
} }
_pcsp__atof_native = [][2]uint32{ _pcsp__atof_native = [][2]uint32{
{1, 0}, {1, 0},
{4, 8}, {4, 8},
{587, 56}, {596, 56},
{591, 8}, {600, 8},
{593, 0}, {602, 0},
} }
_pcsp__decimal_to_f64 = [][2]uint32{ _pcsp__decimal_to_f64 = [][2]uint32{
{1, 0}, {1, 0},
@ -484,60 +537,62 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{1673, 56}, {1431, 56},
{1677, 48}, {1435, 48},
{1678, 40}, {1436, 40},
{1680, 32}, {1438, 32},
{1682, 24}, {1440, 24},
{1684, 16}, {1442, 16},
{1686, 8}, {1444, 8},
{1690, 0}, {1448, 0},
{1702, 56}, {1460, 56},
}
_pcsp__right_shift = [][2]uint32{
{1, 0},
{318, 8},
{319, 0},
{387, 8},
{388, 0},
{396, 8},
{398, 0},
} }
_pcsp__left_shift = [][2]uint32{ _pcsp__left_shift = [][2]uint32{
{1, 0}, {1, 0},
{4, 8}, {4, 8},
{6, 16}, {6, 16},
{363, 24}, {8, 24},
{364, 16}, {418, 32},
{366, 8}, {419, 24},
{367, 0}, {421, 16},
{470, 24}, {423, 8},
{471, 16}, {424, 0},
{539, 32},
}
_pcsp__right_shift = [][2]uint32{
{1, 0},
{4, 8},
{452, 16},
{453, 8},
{454, 0},
{462, 16},
{463, 8},
{464, 0},
{472, 16},
{473, 8}, {473, 8},
{474, 0}, {475, 0},
{486, 24},
} }
_pcsp__vsigned = [][2]uint32{ _pcsp__vsigned = [][2]uint32{
{1, 0}, {1, 0},
{4, 8}, {4, 8},
{112, 16}, {113, 16},
{113, 8}, {114, 8},
{114, 0}, {115, 0},
{125, 16}, {126, 16},
{126, 8}, {127, 8},
{127, 0}, {128, 0},
{260, 16}, {278, 16},
{261, 8}, {279, 8},
{262, 0}, {280, 0},
{266, 16}, {284, 16},
{267, 8}, {285, 8},
{268, 0}, {286, 0},
{306, 16}, {340, 16},
{307, 8}, {341, 8},
{308, 0}, {342, 0},
{316, 16}, {353, 16},
{317, 8}, {354, 8},
{319, 0}, {356, 0},
} }
_pcsp__vstring = [][2]uint32{ _pcsp__vstring = [][2]uint32{
{1, 0}, {1, 0},
@ -556,18 +611,32 @@ var (
} }
_pcsp__vunsigned = [][2]uint32{ _pcsp__vunsigned = [][2]uint32{
{1, 0}, {1, 0},
{71, 8}, {4, 8},
{72, 0}, {6, 16},
{83, 8}, {74, 24},
{84, 0}, {75, 16},
{107, 8}, {77, 8},
{108, 0}, {78, 0},
{273, 8}, {89, 24},
{274, 0}, {90, 16},
{312, 8}, {92, 8},
{313, 0}, {93, 0},
{320, 8}, {116, 24},
{322, 0}, {117, 16},
{119, 8},
{120, 0},
{281, 24},
{282, 16},
{284, 8},
{285, 0},
{336, 24},
{337, 16},
{339, 8},
{340, 0},
{348, 24},
{349, 16},
{351, 8},
{353, 0},
} }
) )
@ -584,6 +653,8 @@ var Funcs = []loader.CFunc{
{"_do_skip_number", _entry__do_skip_number, _size__do_skip_number, _stack__do_skip_number, _pcsp__do_skip_number}, {"_do_skip_number", _entry__do_skip_number, _size__do_skip_number, _stack__do_skip_number, _pcsp__do_skip_number},
{"_get_by_path", _entry__get_by_path, _size__get_by_path, _stack__get_by_path, _pcsp__get_by_path}, {"_get_by_path", _entry__get_by_path, _size__get_by_path, _stack__get_by_path, _pcsp__get_by_path},
{"_skip_one_fast", _entry__skip_one_fast, _size__skip_one_fast, _stack__skip_one_fast, _pcsp__skip_one_fast}, {"_skip_one_fast", _entry__skip_one_fast, _size__skip_one_fast, _stack__skip_one_fast, _pcsp__skip_one_fast},
{"_unescape", _entry__unescape, _size__unescape, _stack__unescape, _pcsp__unescape},
{"_unhex16_is", _entry__unhex16_is, _size__unhex16_is, _stack__unhex16_is, _pcsp__unhex16_is},
{"_html_escape", _entry__html_escape, _size__html_escape, _stack__html_escape, _pcsp__html_escape}, {"_html_escape", _entry__html_escape, _size__html_escape, _stack__html_escape, _pcsp__html_escape},
{"_i64toa", _entry__i64toa, _size__i64toa, _stack__i64toa, _pcsp__i64toa}, {"_i64toa", _entry__i64toa, _size__i64toa, _stack__i64toa, _pcsp__i64toa},
{"_u64toa", _entry__u64toa, _size__u64toa, _stack__u64toa, _pcsp__u64toa}, {"_u64toa", _entry__u64toa, _size__u64toa, _stack__u64toa, _pcsp__u64toa},
@ -602,8 +673,8 @@ var Funcs = []loader.CFunc{
{"_atof_eisel_lemire64", _entry__atof_eisel_lemire64, _size__atof_eisel_lemire64, _stack__atof_eisel_lemire64, _pcsp__atof_eisel_lemire64}, {"_atof_eisel_lemire64", _entry__atof_eisel_lemire64, _size__atof_eisel_lemire64, _stack__atof_eisel_lemire64, _pcsp__atof_eisel_lemire64},
{"_atof_native", _entry__atof_native, _size__atof_native, _stack__atof_native, _pcsp__atof_native}, {"_atof_native", _entry__atof_native, _size__atof_native, _stack__atof_native, _pcsp__atof_native},
{"_decimal_to_f64", _entry__decimal_to_f64, _size__decimal_to_f64, _stack__decimal_to_f64, _pcsp__decimal_to_f64}, {"_decimal_to_f64", _entry__decimal_to_f64, _size__decimal_to_f64, _stack__decimal_to_f64, _pcsp__decimal_to_f64},
{"_right_shift", _entry__right_shift, _size__right_shift, _stack__right_shift, _pcsp__right_shift},
{"_left_shift", _entry__left_shift, _size__left_shift, _stack__left_shift, _pcsp__left_shift}, {"_left_shift", _entry__left_shift, _size__left_shift, _stack__left_shift, _pcsp__left_shift},
{"_right_shift", _entry__right_shift, _size__right_shift, _stack__right_shift, _pcsp__right_shift},
{"_vsigned", _entry__vsigned, _size__vsigned, _stack__vsigned, _pcsp__vsigned}, {"_vsigned", _entry__vsigned, _size__vsigned, _stack__vsigned, _pcsp__vsigned},
{"_vstring", _entry__vstring, _size__vstring, _stack__vstring, _pcsp__vstring}, {"_vstring", _entry__vstring, _size__vstring, _stack__vstring, _pcsp__vstring},
{"_vunsigned", _entry__vunsigned, _size__vunsigned, _stack__vunsigned, _pcsp__vunsigned}, {"_vunsigned", _entry__vunsigned, _size__vunsigned, _stack__vunsigned, _pcsp__vunsigned},

File diff suppressed because it is too large Load Diff

@ -186,4 +186,4 @@ func validate_utf8_fast(s *string) (ret int) {
//go:nosplit //go:nosplit
func fsm_exec(m *types.StateMachine, s *string, p *int, flags uint64) (ret int) { func fsm_exec(m *types.StateMachine, s *string, p *int, flags uint64) (ret int) {
return __fsm_exec(rt.NoEscape(unsafe.Pointer(m)), rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p)), flags) return __fsm_exec(rt.NoEscape(unsafe.Pointer(m)), rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p)), flags)
} }

@ -539,6 +539,14 @@ func TestNative_SkipNumber(t *testing.T) {
assert.Equal(t, 0, q) assert.Equal(t, 0, q)
} }
func TestNative_SkipNumberInJson(t *testing.T) {
p := 0x13
s := "{\"h\":\"1.00000\",\"i\":true,\"pass3\":1}"
q := skip_number(&s, &p)
assert.Equal(t, 0x13, p)
assert.Equal(t, -2, q)
}
func TestNative_SkipOneFast(t *testing.T) { func TestNative_SkipOneFast(t *testing.T) {
p := 0 p := 0
s := ` {"asdf": [null, true, false, 1, 2.0, -3]}, 1234.5` s := ` {"asdf": [null, true, false, 1, 2.0, -3]}, 1234.5`

@ -8,111 +8,117 @@ import (
) )
const ( const (
_entry__f32toa = 31616 _entry__f32toa = 31344
_entry__f64toa = 160 _entry__f64toa = 128
_entry__format_significand = 35888 _entry__format_significand = 36272
_entry__format_integer = 2960 _entry__format_integer = 3280
_entry__fsm_exec = 18016 _entry__fsm_exec = 18832
_entry__advance_string = 14352 _entry__advance_string = 15024
_entry__advance_string_default = 37280 _entry__advance_string_default = 37808
_entry__do_skip_number = 20608 _entry__do_skip_number = 21376
_entry__get_by_path = 26176 _entry__get_by_path = 26768
_entry__skip_one_fast = 22272 _entry__skip_one_fast = 22896
_entry__html_escape = 8912 _entry__unescape = 38752
_entry__i64toa = 3392 _entry__unhex16_is = 9584
_entry__u64toa = 3520 _entry__html_escape = 9776
_entry__i64toa = 3712
_entry__u64toa = 3984
_entry__lspace = 16 _entry__lspace = 16
_entry__quote = 4832 _entry__quote = 5472
_entry__skip_array = 17984 _entry__skip_array = 18800
_entry__skip_number = 21904 _entry__skip_number = 22496
_entry__skip_object = 20256 _entry__skip_object = 21024
_entry__skip_one = 22048 _entry__skip_one = 22672
_entry__unquote = 6576 _entry__unquote = 7248
_entry__validate_one = 22096 _entry__validate_one = 22720
_entry__validate_utf8 = 30384 _entry__validate_utf8 = 30096
_entry__validate_utf8_fast = 31056 _entry__validate_utf8_fast = 30784
_entry__value = 12352 _entry__value = 13072
_entry__vnumber = 15744 _entry__vnumber = 16400
_entry__atof_eisel_lemire64 = 10192 _entry__atof_eisel_lemire64 = 11072
_entry__atof_native = 11744 _entry__atof_native = 12464
_entry__decimal_to_f64 = 10560 _entry__decimal_to_f64 = 11472
_entry__right_shift = 36848 _entry__left_shift = 36752
_entry__left_shift = 36352 _entry__right_shift = 37296
_entry__vsigned = 17296 _entry__vsigned = 18048
_entry__vstring = 14176 _entry__vstring = 14848
_entry__vunsigned = 17632 _entry__vunsigned = 18416
) )
const ( const (
_stack__f32toa = 48 _stack__f32toa = 64
_stack__f64toa = 80 _stack__f64toa = 80
_stack__format_significand = 24 _stack__format_significand = 24
_stack__format_integer = 16 _stack__format_integer = 16
_stack__fsm_exec = 168 _stack__fsm_exec = 160
_stack__advance_string = 64 _stack__advance_string = 72
_stack__advance_string_default = 64 _stack__advance_string_default = 56
_stack__do_skip_number = 48 _stack__do_skip_number = 32
_stack__get_by_path = 272 _stack__get_by_path = 264
_stack__skip_one_fast = 136 _stack__skip_one_fast = 136
_stack__html_escape = 72 _stack__unescape = 64
_stack__unhex16_is = 8
_stack__html_escape = 64
_stack__i64toa = 16 _stack__i64toa = 16
_stack__u64toa = 8 _stack__u64toa = 8
_stack__lspace = 8 _stack__lspace = 8
_stack__quote = 64 _stack__quote = 80
_stack__skip_array = 176 _stack__skip_array = 168
_stack__skip_number = 88 _stack__skip_number = 88
_stack__skip_object = 176 _stack__skip_object = 168
_stack__skip_one = 176 _stack__skip_one = 168
_stack__unquote = 88 _stack__unquote = 112
_stack__validate_one = 176 _stack__validate_one = 168
_stack__validate_utf8 = 48 _stack__validate_utf8 = 48
_stack__validate_utf8_fast = 24 _stack__validate_utf8_fast = 24
_stack__value = 328 _stack__value = 352
_stack__vnumber = 240 _stack__vnumber = 264
_stack__atof_eisel_lemire64 = 32 _stack__atof_eisel_lemire64 = 40
_stack__atof_native = 136 _stack__atof_native = 144
_stack__decimal_to_f64 = 80 _stack__decimal_to_f64 = 88
_stack__right_shift = 8 _stack__left_shift = 32
_stack__left_shift = 24 _stack__right_shift = 16
_stack__vsigned = 16 _stack__vsigned = 16
_stack__vstring = 120 _stack__vstring = 128
_stack__vunsigned = 8 _stack__vunsigned = 24
) )
const ( const (
_size__f32toa = 3328 _size__f32toa = 3696
_size__f64toa = 2800 _size__f64toa = 3152
_size__format_significand = 464 _size__format_significand = 480
_size__format_integer = 432 _size__format_integer = 432
_size__fsm_exec = 1692 _size__fsm_exec = 1656
_size__advance_string = 1344 _size__advance_string = 1328
_size__advance_string_default = 960 _size__advance_string_default = 944
_size__do_skip_number = 956 _size__do_skip_number = 908
_size__get_by_path = 4208 _size__get_by_path = 3328
_size__skip_one_fast = 3404 _size__skip_one_fast = 3348
_size__html_escape = 1280 _size__unescape = 704
_size__i64toa = 48 _size__unhex16_is = 128
_size__u64toa = 1264 _size__html_escape = 1296
_size__lspace = 128 _size__i64toa = 272
_size__quote = 1728 _size__u64toa = 1440
_size__lspace = 96
_size__quote = 1760
_size__skip_array = 32 _size__skip_array = 32
_size__skip_number = 144 _size__skip_number = 160
_size__skip_object = 32 _size__skip_object = 32
_size__skip_one = 48 _size__skip_one = 32
_size__unquote = 2272 _size__unquote = 2336
_size__validate_one = 48 _size__validate_one = 48
_size__validate_utf8 = 672 _size__validate_utf8 = 688
_size__validate_utf8_fast = 544 _size__validate_utf8_fast = 544
_size__value = 1316 _size__value = 1268
_size__vnumber = 1552 _size__vnumber = 1648
_size__atof_eisel_lemire64 = 368 _size__atof_eisel_lemire64 = 400
_size__atof_native = 608 _size__atof_native = 608
_size__decimal_to_f64 = 1184 _size__decimal_to_f64 = 992
_size__right_shift = 400 _size__left_shift = 544
_size__left_shift = 496 _size__right_shift = 480
_size__vsigned = 336 _size__vsigned = 368
_size__vstring = 128 _size__vstring = 128
_size__vunsigned = 336 _size__vunsigned = 368
) )
var ( var (
@ -123,14 +129,16 @@ var (
{8, 24}, {8, 24},
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{3286, 48}, {13, 48},
{3287, 40}, {3638, 64},
{3289, 32}, {3642, 48},
{3291, 24}, {3643, 40},
{3293, 16}, {3645, 32},
{3295, 8}, {3647, 24},
{3296, 0}, {3649, 16},
{3318, 48}, {3651, 8},
{3652, 0},
{3682, 64},
} }
_pcsp__f64toa = [][2]uint32{ _pcsp__f64toa = [][2]uint32{
{1, 0}, {1, 0},
@ -140,24 +148,24 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{2740, 56}, {3033, 56},
{2744, 48}, {3037, 48},
{2745, 40}, {3038, 40},
{2747, 32}, {3040, 32},
{2749, 24}, {3042, 24},
{2751, 16}, {3044, 16},
{2753, 8}, {3046, 8},
{2754, 0}, {3047, 0},
{2792, 56}, {3138, 56},
} }
_pcsp__format_significand = [][2]uint32{ _pcsp__format_significand = [][2]uint32{
{1, 0}, {1, 0},
{4, 8}, {4, 8},
{6, 16}, {6, 16},
{452, 24}, {468, 24},
{453, 16}, {469, 16},
{455, 8}, {471, 8},
{457, 0}, {473, 0},
} }
_pcsp__format_integer = [][2]uint32{ _pcsp__format_integer = [][2]uint32{
{1, 0}, {1, 0},
@ -177,15 +185,15 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{1342, 104}, {1317, 88},
{1346, 48}, {1321, 48},
{1347, 40}, {1322, 40},
{1349, 32}, {1324, 32},
{1351, 24}, {1326, 24},
{1353, 16}, {1328, 16},
{1355, 8}, {1330, 8},
{1356, 0}, {1331, 0},
{1692, 104}, {1656, 88},
} }
_pcsp__advance_string = [][2]uint32{ _pcsp__advance_string = [][2]uint32{
{14, 0}, {14, 0},
@ -195,15 +203,15 @@ var (
{24, 32}, {24, 32},
{26, 40}, {26, 40},
{27, 48}, {27, 48},
{614, 56}, {587, 72},
{618, 48}, {591, 48},
{619, 40}, {592, 40},
{621, 32}, {594, 32},
{623, 24}, {596, 24},
{625, 16}, {598, 16},
{627, 8}, {600, 8},
{628, 0}, {601, 0},
{1339, 56}, {1325, 72},
} }
_pcsp__advance_string_default = [][2]uint32{ _pcsp__advance_string_default = [][2]uint32{
{1, 0}, {1, 0},
@ -213,31 +221,27 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{576, 64}, {402, 56},
{580, 48}, {406, 48},
{581, 40}, {407, 40},
{583, 32}, {409, 32},
{585, 24}, {411, 24},
{587, 16}, {413, 16},
{589, 8}, {415, 8},
{590, 0}, {416, 0},
{955, 64}, {936, 56},
} }
_pcsp__do_skip_number = [][2]uint32{ _pcsp__do_skip_number = [][2]uint32{
{1, 0}, {1, 0},
{4, 8}, {4, 8},
{6, 16}, {6, 16},
{8, 24}, {8, 24},
{10, 32}, {771, 32},
{12, 40}, {772, 24},
{881, 48}, {774, 16},
{882, 40}, {776, 8},
{884, 32}, {777, 0},
{886, 24}, {908, 32},
{888, 16},
{890, 8},
{891, 0},
{956, 48},
} }
_pcsp__get_by_path = [][2]uint32{ _pcsp__get_by_path = [][2]uint32{
{1, 0}, {1, 0},
@ -247,15 +251,15 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{4012, 104}, {3278, 104},
{4016, 48}, {3282, 48},
{4017, 40}, {3283, 40},
{4019, 32}, {3285, 32},
{4021, 24}, {3287, 24},
{4023, 16}, {3289, 16},
{4025, 8}, {3291, 8},
{4026, 0}, {3292, 0},
{4194, 104}, {3317, 104},
} }
_pcsp__skip_one_fast = [][2]uint32{ _pcsp__skip_one_fast = [][2]uint32{
{1, 0}, {1, 0},
@ -265,15 +269,44 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{658, 136}, {600, 136},
{662, 48}, {604, 48},
{663, 40}, {605, 40},
{665, 32}, {607, 32},
{667, 24}, {609, 24},
{669, 16}, {611, 16},
{671, 8}, {613, 8},
{672, 0}, {614, 0},
{3404, 136}, {3348, 136},
}
_pcsp__unescape = [][2]uint32{
{1, 0},
{4, 8},
{6, 16},
{8, 24},
{10, 32},
{12, 40},
{13, 48},
{246, 56},
{250, 48},
{251, 40},
{253, 32},
{255, 24},
{257, 16},
{259, 8},
{260, 0},
{695, 56},
}
_pcsp__unhex16_is = [][2]uint32{
{1, 0},
{35, 8},
{36, 0},
{62, 8},
{63, 0},
{97, 8},
{98, 0},
{121, 8},
{123, 0},
} }
_pcsp__html_escape = [][2]uint32{ _pcsp__html_escape = [][2]uint32{
{1, 0}, {1, 0},
@ -283,39 +316,47 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{1256, 72}, {1281, 64},
{1260, 48}, {1285, 48},
{1261, 40}, {1286, 40},
{1263, 32}, {1288, 32},
{1265, 24}, {1290, 24},
{1267, 16}, {1292, 16},
{1269, 8}, {1294, 8},
{1271, 0}, {1296, 0},
} }
_pcsp__i64toa = [][2]uint32{ _pcsp__i64toa = [][2]uint32{
{14, 0}, {1, 0},
{34, 8}, {171, 8},
{36, 0}, {172, 0},
{207, 8},
{208, 0},
{222, 8},
{223, 0},
{247, 8},
{248, 0},
{253, 8},
{259, 0},
} }
_pcsp__u64toa = [][2]uint32{ _pcsp__u64toa = [][2]uint32{
{1, 0}, {13, 0},
{161, 8}, {162, 8},
{162, 0}, {163, 0},
{457, 8}, {175, 8},
{458, 0}, {240, 0},
{772, 8}, {498, 8},
{773, 0}, {499, 0},
{1249, 8}, {519, 8},
{1251, 0}, {608, 0},
{882, 8},
{976, 0},
{1434, 8},
{1436, 0},
} }
_pcsp__lspace = [][2]uint32{ _pcsp__lspace = [][2]uint32{
{1, 0}, {1, 0},
{89, 8}, {85, 8},
{90, 0}, {87, 0},
{103, 8},
{104, 0},
{111, 8},
{113, 0},
} }
_pcsp__quote = [][2]uint32{ _pcsp__quote = [][2]uint32{
{1, 0}, {1, 0},
@ -325,15 +366,15 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{1681, 64}, {1701, 80},
{1685, 48}, {1705, 48},
{1686, 40}, {1706, 40},
{1688, 32}, {1708, 32},
{1690, 24}, {1710, 24},
{1692, 16}, {1712, 16},
{1694, 8}, {1714, 8},
{1695, 0}, {1715, 0},
{1722, 64}, {1750, 80},
} }
_pcsp__skip_array = [][2]uint32{ _pcsp__skip_array = [][2]uint32{
{1, 0}, {1, 0},
@ -346,13 +387,17 @@ var (
{6, 16}, {6, 16},
{8, 24}, {8, 24},
{10, 32}, {10, 32},
{100, 40}, {12, 40},
{101, 32}, {13, 48},
{103, 24}, {107, 56},
{105, 16}, {111, 48},
{107, 8}, {112, 40},
{108, 0}, {114, 32},
{139, 40}, {116, 24},
{118, 16},
{120, 8},
{121, 0},
{145, 56},
} }
_pcsp__skip_object = [][2]uint32{ _pcsp__skip_object = [][2]uint32{
{1, 0}, {1, 0},
@ -361,8 +406,8 @@ var (
} }
_pcsp__skip_one = [][2]uint32{ _pcsp__skip_one = [][2]uint32{
{1, 0}, {1, 0},
{30, 8}, {26, 8},
{36, 0}, {32, 0},
} }
_pcsp__unquote = [][2]uint32{ _pcsp__unquote = [][2]uint32{
{1, 0}, {1, 0},
@ -372,20 +417,20 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{1684, 88}, {1614, 104},
{1688, 48}, {1618, 48},
{1689, 40}, {1619, 40},
{1691, 32}, {1621, 32},
{1693, 24}, {1623, 24},
{1695, 16}, {1625, 16},
{1697, 8}, {1627, 8},
{1698, 0}, {1628, 0},
{2270, 88}, {2329, 104},
} }
_pcsp__validate_one = [][2]uint32{ _pcsp__validate_one = [][2]uint32{
{1, 0}, {1, 0},
{35, 8}, {31, 8},
{41, 0}, {37, 0},
} }
_pcsp__validate_utf8 = [][2]uint32{ _pcsp__validate_utf8 = [][2]uint32{
{1, 0}, {1, 0},
@ -394,14 +439,14 @@ var (
{8, 24}, {8, 24},
{10, 32}, {10, 32},
{11, 40}, {11, 40},
{623, 48}, {639, 48},
{627, 40}, {643, 40},
{628, 32}, {644, 32},
{630, 24}, {646, 24},
{632, 16}, {648, 16},
{634, 8}, {650, 8},
{635, 0}, {651, 0},
{666, 48}, {682, 48},
} }
_pcsp__validate_utf8_fast = [][2]uint32{ _pcsp__validate_utf8_fast = [][2]uint32{
{1, 0}, {1, 0},
@ -424,15 +469,15 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{495, 88}, {439, 88},
{499, 48}, {443, 48},
{500, 40}, {444, 40},
{502, 32}, {446, 32},
{504, 24}, {448, 24},
{506, 16}, {450, 16},
{508, 8}, {452, 8},
{509, 0}, {453, 0},
{1316, 88}, {1268, 88},
} }
_pcsp__vnumber = [][2]uint32{ _pcsp__vnumber = [][2]uint32{
{1, 0}, {1, 0},
@ -442,34 +487,36 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{803, 104}, {150, 120},
{807, 48}, {154, 48},
{808, 40}, {155, 40},
{810, 32}, {157, 32},
{812, 24}, {159, 24},
{814, 16}, {161, 16},
{816, 8}, {163, 8},
{817, 0}, {164, 0},
{1551, 104}, {1642, 120},
} }
_pcsp__atof_eisel_lemire64 = [][2]uint32{ _pcsp__atof_eisel_lemire64 = [][2]uint32{
{1, 0}, {1, 0},
{4, 8}, {4, 8},
{6, 16}, {6, 16},
{8, 24}, {8, 24},
{292, 32}, {10, 32},
{293, 24}, {315, 40},
{295, 16}, {316, 32},
{297, 8}, {318, 24},
{298, 0}, {320, 16},
{362, 32}, {322, 8},
{323, 0},
{387, 40},
} }
_pcsp__atof_native = [][2]uint32{ _pcsp__atof_native = [][2]uint32{
{1, 0}, {1, 0},
{4, 8}, {4, 8},
{587, 56}, {596, 56},
{591, 8}, {600, 8},
{593, 0}, {602, 0},
} }
_pcsp__decimal_to_f64 = [][2]uint32{ _pcsp__decimal_to_f64 = [][2]uint32{
{1, 0}, {1, 0},
@ -479,60 +526,62 @@ var (
{10, 32}, {10, 32},
{12, 40}, {12, 40},
{13, 48}, {13, 48},
{1144, 56}, {951, 56},
{1148, 48}, {955, 48},
{1149, 40}, {956, 40},
{1151, 32}, {958, 32},
{1153, 24}, {960, 24},
{1155, 16}, {962, 16},
{1157, 8}, {964, 8},
{1158, 0}, {965, 0},
{1169, 56}, {977, 56},
}
_pcsp__right_shift = [][2]uint32{
{1, 0},
{318, 8},
{319, 0},
{387, 8},
{388, 0},
{396, 8},
{398, 0},
} }
_pcsp__left_shift = [][2]uint32{ _pcsp__left_shift = [][2]uint32{
{1, 0}, {1, 0},
{4, 8}, {4, 8},
{6, 16}, {6, 16},
{363, 24}, {8, 24},
{364, 16}, {418, 32},
{366, 8}, {419, 24},
{367, 0}, {421, 16},
{470, 24}, {423, 8},
{471, 16}, {424, 0},
{539, 32},
}
_pcsp__right_shift = [][2]uint32{
{1, 0},
{4, 8},
{452, 16},
{453, 8},
{454, 0},
{462, 16},
{463, 8},
{464, 0},
{472, 16},
{473, 8}, {473, 8},
{474, 0}, {475, 0},
{486, 24},
} }
_pcsp__vsigned = [][2]uint32{ _pcsp__vsigned = [][2]uint32{
{1, 0}, {1, 0},
{4, 8}, {4, 8},
{119, 16}, {111, 16},
{120, 8}, {112, 8},
{121, 0}, {113, 0},
{132, 16}, {124, 16},
{133, 8}, {125, 8},
{134, 0}, {126, 0},
{276, 16}, {278, 16},
{277, 8}, {279, 8},
{278, 0}, {280, 0},
{282, 16}, {284, 16},
{283, 8}, {285, 8},
{284, 0}, {286, 0},
{322, 16}, {340, 16},
{323, 8}, {341, 8},
{324, 0}, {342, 0},
{332, 16}, {353, 16},
{333, 8}, {354, 8},
{335, 0}, {356, 0},
} }
_pcsp__vstring = [][2]uint32{ _pcsp__vstring = [][2]uint32{
{1, 0}, {1, 0},
@ -551,18 +600,32 @@ var (
} }
_pcsp__vunsigned = [][2]uint32{ _pcsp__vunsigned = [][2]uint32{
{1, 0}, {1, 0},
{78, 8}, {4, 8},
{79, 0}, {6, 16},
{72, 24},
{73, 16},
{75, 8},
{76, 0},
{87, 24},
{88, 16},
{90, 8}, {90, 8},
{91, 0}, {91, 0},
{114, 8}, {114, 24},
{115, 0}, {115, 16},
{273, 8}, {117, 8},
{274, 0}, {118, 0},
{312, 8}, {281, 24},
{313, 0}, {282, 16},
{320, 8}, {284, 8},
{322, 0}, {285, 0},
{336, 24},
{337, 16},
{339, 8},
{340, 0},
{348, 24},
{349, 16},
{351, 8},
{353, 0},
} }
) )
@ -578,6 +641,8 @@ var Funcs = []loader.CFunc{
{"_do_skip_number", _entry__do_skip_number, _size__do_skip_number, _stack__do_skip_number, _pcsp__do_skip_number}, {"_do_skip_number", _entry__do_skip_number, _size__do_skip_number, _stack__do_skip_number, _pcsp__do_skip_number},
{"_get_by_path", _entry__get_by_path, _size__get_by_path, _stack__get_by_path, _pcsp__get_by_path}, {"_get_by_path", _entry__get_by_path, _size__get_by_path, _stack__get_by_path, _pcsp__get_by_path},
{"_skip_one_fast", _entry__skip_one_fast, _size__skip_one_fast, _stack__skip_one_fast, _pcsp__skip_one_fast}, {"_skip_one_fast", _entry__skip_one_fast, _size__skip_one_fast, _stack__skip_one_fast, _pcsp__skip_one_fast},
{"_unescape", _entry__unescape, _size__unescape, _stack__unescape, _pcsp__unescape},
{"_unhex16_is", _entry__unhex16_is, _size__unhex16_is, _stack__unhex16_is, _pcsp__unhex16_is},
{"_html_escape", _entry__html_escape, _size__html_escape, _stack__html_escape, _pcsp__html_escape}, {"_html_escape", _entry__html_escape, _size__html_escape, _stack__html_escape, _pcsp__html_escape},
{"_i64toa", _entry__i64toa, _size__i64toa, _stack__i64toa, _pcsp__i64toa}, {"_i64toa", _entry__i64toa, _size__i64toa, _stack__i64toa, _pcsp__i64toa},
{"_u64toa", _entry__u64toa, _size__u64toa, _stack__u64toa, _pcsp__u64toa}, {"_u64toa", _entry__u64toa, _size__u64toa, _stack__u64toa, _pcsp__u64toa},
@ -596,8 +661,8 @@ var Funcs = []loader.CFunc{
{"_atof_eisel_lemire64", _entry__atof_eisel_lemire64, _size__atof_eisel_lemire64, _stack__atof_eisel_lemire64, _pcsp__atof_eisel_lemire64}, {"_atof_eisel_lemire64", _entry__atof_eisel_lemire64, _size__atof_eisel_lemire64, _stack__atof_eisel_lemire64, _pcsp__atof_eisel_lemire64},
{"_atof_native", _entry__atof_native, _size__atof_native, _stack__atof_native, _pcsp__atof_native}, {"_atof_native", _entry__atof_native, _size__atof_native, _stack__atof_native, _pcsp__atof_native},
{"_decimal_to_f64", _entry__decimal_to_f64, _size__decimal_to_f64, _stack__decimal_to_f64, _pcsp__decimal_to_f64}, {"_decimal_to_f64", _entry__decimal_to_f64, _size__decimal_to_f64, _stack__decimal_to_f64, _pcsp__decimal_to_f64},
{"_right_shift", _entry__right_shift, _size__right_shift, _stack__right_shift, _pcsp__right_shift},
{"_left_shift", _entry__left_shift, _size__left_shift, _stack__left_shift, _pcsp__left_shift}, {"_left_shift", _entry__left_shift, _size__left_shift, _stack__left_shift, _pcsp__left_shift},
{"_right_shift", _entry__right_shift, _size__right_shift, _stack__right_shift, _pcsp__right_shift},
{"_vsigned", _entry__vsigned, _size__vsigned, _stack__vsigned, _pcsp__vsigned}, {"_vsigned", _entry__vsigned, _size__vsigned, _stack__vsigned, _pcsp__vsigned},
{"_vstring", _entry__vstring, _size__vstring, _stack__vstring, _pcsp__vstring}, {"_vstring", _entry__vstring, _size__vstring, _stack__vstring, _pcsp__vstring},
{"_vunsigned", _entry__vunsigned, _size__vunsigned, _stack__vunsigned, _pcsp__vunsigned}, {"_vunsigned", _entry__vunsigned, _size__vunsigned, _stack__vunsigned, _pcsp__vunsigned},

File diff suppressed because it is too large Load Diff

@ -58,6 +58,9 @@ func (cfg Config) Froze() API {
if cfg.ValidateString { if cfg.ValidateString {
api.encoderOpts |= encoder.ValidateString api.encoderOpts |= encoder.ValidateString
} }
if cfg.NoValidateJSONMarshaler {
api.encoderOpts |= encoder.NoValidateJSONMarshaler
}
// configure decoder options: // configure decoder options:
if cfg.UseInt64 { if cfg.UseInt64 {
@ -139,23 +142,23 @@ func (cfg frozenConfig) Valid(data []byte) bool {
// Opts are the compile options, for example, "option.WithCompileRecursiveDepth" is // Opts are the compile options, for example, "option.WithCompileRecursiveDepth" is
// a compile option to set the depth of recursive compile for the nested struct type. // a compile option to set the depth of recursive compile for the nested struct type.
func Pretouch(vt reflect.Type, opts ...option.CompileOption) error { func Pretouch(vt reflect.Type, opts ...option.CompileOption) error {
if err := encoder.Pretouch(vt, opts...); err != nil { if err := encoder.Pretouch(vt, opts...); err != nil {
return err return err
} }
if err := decoder.Pretouch(vt, opts...); err != nil { if err := decoder.Pretouch(vt, opts...); err != nil {
return err return err
} }
// to pretouch the corresponding pointer type as well // to pretouch the corresponding pointer type as well
if vt.Kind() == reflect.Ptr { if vt.Kind() == reflect.Ptr {
vt = vt.Elem() vt = vt.Elem()
} else { } else {
vt = reflect.PtrTo(vt) vt = reflect.PtrTo(vt)
} }
if err := encoder.Pretouch(vt, opts...); err != nil { if err := encoder.Pretouch(vt, opts...); err != nil {
return err return err
} }
if err := decoder.Pretouch(vt, opts...); err != nil { if err := decoder.Pretouch(vt, opts...); err != nil {
return err return err
} }
return nil return nil
} }

@ -24,7 +24,7 @@ github.com/baidubce/bce-sdk-go/util/log
github.com/basgys/goxml2json github.com/basgys/goxml2json
# github.com/bitly/go-simplejson v0.5.0 # github.com/bitly/go-simplejson v0.5.0
## explicit ## explicit
# github.com/bytedance/sonic v1.10.0 # github.com/bytedance/sonic v1.10.1
## explicit; go 1.16 ## explicit; go 1.16
github.com/bytedance/sonic github.com/bytedance/sonic
github.com/bytedance/sonic/ast github.com/bytedance/sonic/ast

Loading…
Cancel
Save