chore: migrate to gitea
Some checks failed
golangci-lint / lint (push) Failing after 21s
Test / test (push) Failing after 2m17s

This commit is contained in:
2026-01-27 01:40:31 +01:00
parent a9bca767a9
commit 1a27ed5274
3163 changed files with 1216358 additions and 1529 deletions

View File

View File

@@ -0,0 +1,115 @@
/*
* 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 caching
import (
`strings`
`unsafe`
`github.com/bytedance/sonic/internal/rt`
)
type FieldMap struct {
N uint64
b unsafe.Pointer
m map[string]int
}
type FieldEntry struct {
ID int
Name string
Hash uint64
}
const (
FieldMap_N = int64(unsafe.Offsetof(FieldMap{}.N))
FieldMap_b = int64(unsafe.Offsetof(FieldMap{}.b))
FieldEntrySize = int64(unsafe.Sizeof(FieldEntry{}))
)
func newBucket(n int) unsafe.Pointer {
v := make([]FieldEntry, n)
return (*rt.GoSlice)(unsafe.Pointer(&v)).Ptr
}
func CreateFieldMap(n int) *FieldMap {
return &FieldMap {
N: uint64(n * 2),
b: newBucket(n * 2), // LoadFactor = 0.5
m: make(map[string]int, n * 2),
}
}
func (self *FieldMap) At(p uint64) *FieldEntry {
off := uintptr(p) * uintptr(FieldEntrySize)
return (*FieldEntry)(unsafe.Pointer(uintptr(self.b) + off))
}
// Get searches FieldMap by name. JIT generated assembly does NOT call this
// function, rather it implements its own version directly in assembly. So
// we must ensure this function stays in sync with the JIT generated one.
func (self *FieldMap) Get(name string) int {
h := StrHash(name)
p := h % self.N
s := self.At(p)
/* find the element;
* the hash map is never full, so the loop will always terminate */
for s.Hash != 0 {
if s.Hash == h && s.Name == name {
return s.ID
} else {
p = (p + 1) % self.N
s = self.At(p)
}
}
/* not found */
return -1
}
func (self *FieldMap) Set(name string, i int) {
h := StrHash(name)
p := h % self.N
s := self.At(p)
/* searching for an empty slot;
* the hash map is never full, so the loop will always terminate */
for s.Hash != 0 {
p = (p + 1) % self.N
s = self.At(p)
}
/* set the value */
s.ID = i
s.Hash = h
s.Name = name
/* add the case-insensitive version, prefer the one with smaller field ID */
key := strings.ToLower(name)
if v, ok := self.m[key]; !ok || i < v {
self.m[key] = i
}
}
func (self *FieldMap) GetCaseInsensitive(name string) int {
if i, ok := self.m[strings.ToLower(name)]; ok {
return i
} else {
return -1
}
}

View File

@@ -0,0 +1,36 @@
/*
* 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 caching
import (
`unsafe`
`github.com/bytedance/sonic/internal/rt`
)
var (
V_strhash = rt.UnpackEface(rt.Strhash)
S_strhash = *(*uintptr)(V_strhash.Value)
)
func StrHash(s string) uint64 {
if v := rt.Strhash(unsafe.Pointer(&s), 0); v == 0 {
return 1
} else {
return uint64(v)
}
}

View File

@@ -0,0 +1,179 @@
/*
* 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 caching
import (
`sync`
`sync/atomic`
`unsafe`
`github.com/bytedance/sonic/internal/rt`
)
/** Program Map **/
const (
_LoadFactor = 0.5
_InitCapacity = 4096 // must be a power of 2
)
type _ProgramMap struct {
n uint64
m uint32
b []_ProgramEntry
}
type _ProgramEntry struct {
vt *rt.GoType
fn interface{}
}
func newProgramMap() *_ProgramMap {
return &_ProgramMap {
n: 0,
m: _InitCapacity - 1,
b: make([]_ProgramEntry, _InitCapacity),
}
}
func (self *_ProgramMap) copy() *_ProgramMap {
fork := &_ProgramMap{
n: self.n,
m: self.m,
b: make([]_ProgramEntry, len(self.b)),
}
for i, f := range self.b {
fork.b[i] = f
}
return fork
}
func (self *_ProgramMap) get(vt *rt.GoType) interface{} {
i := self.m + 1
p := vt.Hash & self.m
/* linear probing */
for ; i > 0; i-- {
if b := self.b[p]; b.vt == vt {
return b.fn
} else if b.vt == nil {
break
} else {
p = (p + 1) & self.m
}
}
/* not found */
return nil
}
func (self *_ProgramMap) add(vt *rt.GoType, fn interface{}) *_ProgramMap {
p := self.copy()
f := float64(atomic.LoadUint64(&p.n) + 1) / float64(p.m + 1)
/* check for load factor */
if f > _LoadFactor {
p = p.rehash()
}
/* insert the value */
p.insert(vt, fn)
return p
}
func (self *_ProgramMap) rehash() *_ProgramMap {
c := (self.m + 1) << 1
r := &_ProgramMap{m: c - 1, b: make([]_ProgramEntry, int(c))}
/* rehash every entry */
for i := uint32(0); i <= self.m; i++ {
if b := self.b[i]; b.vt != nil {
r.insert(b.vt, b.fn)
}
}
/* rebuild successful */
return r
}
func (self *_ProgramMap) insert(vt *rt.GoType, fn interface{}) {
h := vt.Hash
p := h & self.m
/* linear probing */
for i := uint32(0); i <= self.m; i++ {
if b := &self.b[p]; b.vt != nil {
p += 1
p &= self.m
} else {
b.vt = vt
b.fn = fn
atomic.AddUint64(&self.n, 1)
return
}
}
/* should never happens */
panic("no available slots")
}
/** RCU Program Cache **/
type ProgramCache struct {
m sync.Mutex
p unsafe.Pointer
}
func CreateProgramCache() *ProgramCache {
return &ProgramCache {
m: sync.Mutex{},
p: unsafe.Pointer(newProgramMap()),
}
}
func (self *ProgramCache) Reset() {
self.m.Lock()
defer self.m.Unlock()
self.p = unsafe.Pointer(newProgramMap())
}
func (self *ProgramCache) Get(vt *rt.GoType) interface{} {
return (*_ProgramMap)(atomic.LoadPointer(&self.p)).get(vt)
}
func (self *ProgramCache) Compute(vt *rt.GoType, compute func(*rt.GoType, ... interface{}) (interface{}, error), ex ...interface{}) (interface{}, error) {
var err error
var val interface{}
/* use defer to prevent inlining of this function */
self.m.Lock()
defer self.m.Unlock()
/* double check with write lock held */
if val = self.Get(vt); val != nil {
return val, nil
}
/* compute the value */
if val, err = compute(vt, ex...); err != nil {
return nil, err
}
/* update the RCU cache */
atomic.StorePointer(&self.p, unsafe.Pointer((*_ProgramMap)(atomic.LoadPointer(&self.p)).add(vt, val)))
return val, nil
}

View File

@@ -0,0 +1,12 @@
// +build !amd64,!arm64 go1.27 !go1.17 arm64,!go1.20
package compat
import (
"fmt"
"os"
)
func Warn(prefix string) {
fmt.Fprintf(os.Stderr, "WARNING: %s only supports (go1.17~1.26 and amd64 CPU) or (go1.20~1.26 and arm64 CPU), but your environment is not suitable and will fallback to encoding/json\n", prefix)
}

View File

@@ -0,0 +1,40 @@
/*
* 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 cpu
import (
`fmt`
`os`
`github.com/klauspost/cpuid/v2`
)
var (
HasAVX2 = cpuid.CPU.Has(cpuid.AVX2)
HasSSE = cpuid.CPU.Has(cpuid.SSE)
)
func init() {
switch v := os.Getenv("SONIC_MODE"); v {
case "" : break
case "auto" : break
case "noavx" : HasAVX2 = false
// will also disable avx, act as `noavx`, we remain it to make sure forward compatibility
case "noavx2" : HasAVX2 = false
default : panic(fmt.Sprintf("invalid mode: '%s', should be one of 'auto', 'noavx', 'noavx2'", v))
}
}

View File

@@ -0,0 +1,175 @@
/*
* 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 api
import (
`reflect`
`github.com/bytedance/sonic/internal/native`
`github.com/bytedance/sonic/internal/native/types`
`github.com/bytedance/sonic/internal/decoder/consts`
`github.com/bytedance/sonic/internal/decoder/errors`
`github.com/bytedance/sonic/internal/rt`
`github.com/bytedance/sonic/option`
)
const (
_F_allow_control = consts.F_allow_control
_F_copy_string = consts.F_copy_string
_F_disable_unknown = consts.F_disable_unknown
_F_disable_urc = consts.F_disable_urc
_F_use_int64 = consts.F_use_int64
_F_use_number = consts.F_use_number
_F_validate_string = consts.F_validate_string
_F_case_sensitive = consts.F_case_sensitive
_MaxStack = consts.MaxStack
OptionUseInt64 = consts.OptionUseInt64
OptionUseNumber = consts.OptionUseNumber
OptionUseUnicodeErrors = consts.OptionUseUnicodeErrors
OptionDisableUnknown = consts.OptionDisableUnknown
OptionCopyString = consts.OptionCopyString
OptionValidateString = consts.OptionValidateString
OptionNoValidateJSON = consts.OptionNoValidateJSON
OptionCaseSensitive = consts.OptionCaseSensitive
)
type (
Options = consts.Options
MismatchTypeError = errors.MismatchTypeError
SyntaxError = errors.SyntaxError
)
func (self *Decoder) SetOptions(opts Options) {
if (opts & consts.OptionUseNumber != 0) && (opts & consts.OptionUseInt64 != 0) {
panic("can't set OptionUseInt64 and OptionUseNumber both!")
}
self.f = uint64(opts)
}
// Decoder is the decoder context object
type Decoder struct {
i int
f uint64
s string
}
// NewDecoder creates a new decoder instance.
func NewDecoder(s string) *Decoder {
return &Decoder{s: s}
}
// Pos returns the current decoding position.
func (self *Decoder) Pos() int {
return self.i
}
func (self *Decoder) Reset(s string) {
self.s = s
self.i = 0
// self.f = 0
}
func (self *Decoder) CheckTrailings() error {
pos := self.i
buf := self.s
/* skip all the trailing spaces */
if pos != len(buf) {
for pos < len(buf) && (types.SPACE_MASK & (1 << buf[pos])) != 0 {
pos++
}
}
/* then it must be at EOF */
if pos == len(buf) {
return nil
}
/* junk after JSON value */
return SyntaxError {
Src : buf,
Pos : pos,
Code : types.ERR_INVALID_CHAR,
}
}
// Decode parses the JSON-encoded data from current position and stores the result
// in the value pointed to by val.
func (self *Decoder) Decode(val interface{}) error {
return decodeImpl(&self.s, &self.i, self.f, val)
}
// UseInt64 indicates the Decoder to unmarshal an integer into an interface{} as an
// int64 instead of as a float64.
func (self *Decoder) UseInt64() {
self.f |= 1 << _F_use_int64
self.f &^= 1 << _F_use_number
}
// UseNumber indicates the Decoder to unmarshal a number into an interface{} as a
// json.Number instead of as a float64.
func (self *Decoder) UseNumber() {
self.f &^= 1 << _F_use_int64
self.f |= 1 << _F_use_number
}
// UseUnicodeErrors indicates the Decoder to return an error when encounter invalid
// UTF-8 escape sequences.
func (self *Decoder) UseUnicodeErrors() {
self.f |= 1 << _F_disable_urc
}
// DisallowUnknownFields indicates the Decoder to return an error when the destination
// is a struct and the input contains object keys which do not match any
// non-ignored, exported fields in the destination.
func (self *Decoder) DisallowUnknownFields() {
self.f |= 1 << _F_disable_unknown
}
// CopyString indicates the Decoder to decode string values by copying instead of referring.
func (self *Decoder) CopyString() {
self.f |= 1 << _F_copy_string
}
// ValidateString causes the Decoder to validate string values when decoding string value
// in JSON. Validation is that, returning error when unescaped control chars(0x00-0x1f) or
// invalid UTF-8 chars in the string value of JSON.
func (self *Decoder) ValidateString() {
self.f |= 1 << _F_validate_string
}
// Pretouch compiles vt ahead-of-time to avoid JIT compilation on-the-fly, in
// order to reduce the first-hit latency.
//
// 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.
func Pretouch(vt reflect.Type, opts ...option.CompileOption) error {
return pretouchImpl(vt, opts...)
}
// Skip skips only one json value, and returns first non-blank character position and its ending position if it is valid.
// Otherwise, returns negative error code using start and invalid character position using end
func Skip(data []byte) (start int, end int) {
s := rt.Mem2Str(data)
p := 0
m := types.NewStateMachine()
ret := native.SkipOne(&s, &p, m, uint64(0))
types.FreeStateMachine(m)
return ret, p
}

View File

@@ -0,0 +1,38 @@
//go:build go1.17 && !go1.27
// +build go1.17,!go1.27
/*
* 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 api
import (
"github.com/bytedance/sonic/internal/envs"
"github.com/bytedance/sonic/internal/decoder/jitdec"
"github.com/bytedance/sonic/internal/decoder/optdec"
)
var (
pretouchImpl = jitdec.Pretouch
decodeImpl = jitdec.Decode
)
func init() {
if envs.UseOptDec {
pretouchImpl = optdec.Pretouch
decodeImpl = optdec.Decode
}
}

View File

@@ -0,0 +1,38 @@
// +build go1.17,!go1.27
/*
* 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 api
import (
`github.com/bytedance/sonic/internal/decoder/optdec`
`github.com/bytedance/sonic/internal/envs`
)
var (
pretouchImpl = optdec.Pretouch
decodeImpl = optdec.Decode
)
func init() {
// when in aarch64, we enable all optimization
envs.EnableOptDec()
envs.EnableFastMap()
}

View File

@@ -0,0 +1,247 @@
/*
* 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 api
import (
"bytes"
"io"
"sync"
"github.com/bytedance/sonic/internal/native"
"github.com/bytedance/sonic/internal/native/types"
"github.com/bytedance/sonic/internal/rt"
"github.com/bytedance/sonic/internal/utils"
"github.com/bytedance/sonic/option"
)
var (
minLeftBufferShift uint = 1
)
// StreamDecoder is the decoder context object for streaming input.
type StreamDecoder struct {
r io.Reader
buf []byte
scanp int
scanned int64
err error
Decoder
}
var bufPool = sync.Pool{
New: func () interface{} {
return make([]byte, 0, option.DefaultDecoderBufferSize)
},
}
func freeBytes(buf []byte) {
if rt.CanSizeResue(cap(buf)) {
bufPool.Put(buf[:0])
}
}
// NewStreamDecoder adapts to encoding/json.NewDecoder API.
//
// NewStreamDecoder returns a new decoder that reads from r.
func NewStreamDecoder(r io.Reader) *StreamDecoder {
return &StreamDecoder{r : r}
}
// Decode decodes input stream into val with corresponding data.
// Redundantly bytes may be read and left in its buffer, and can be used at next call.
// Either io error from underlying io.Reader (except io.EOF)
// or syntax error from data will be recorded and stop subsequently decoding.
func (self *StreamDecoder) Decode(val interface{}) (err error) {
// read more data into buf
if self.More() {
var s = self.scanp
try_skip:
var e = len(self.buf)
var src = rt.Mem2Str(self.buf[s:e])
// try skip
var x = 0;
if y := native.SkipOneFast(&src, &x); y < 0 {
if self.readMore() {
goto try_skip
}
if self.err == nil {
self.err = SyntaxError{e, self.s, types.ParsingError(-s), ""}
self.setErr(self.err)
}
return self.err
} else {
s = y + s
e = x + s
}
// must copy string here for safety
self.Decoder.Reset(string(self.buf[s:e]))
err = self.Decoder.Decode(val)
if err != nil {
self.setErr(err)
return
}
self.scanp = e
_, empty := self.scan()
if empty {
// no remain valid bytes, thus we just recycle buffer
mem := self.buf
self.buf = nil
freeBytes(mem)
} else {
// remain undecoded bytes, move them onto head
n := copy(self.buf, self.buf[self.scanp:])
self.buf = self.buf[:n]
}
self.scanned += int64(self.scanp)
self.scanp = 0
}
return self.err
}
// InputOffset returns the input stream byte offset of the current decoder position.
// The offset gives the location of the end of the most recently returned token and the beginning of the next token.
func (self *StreamDecoder) InputOffset() int64 {
return self.scanned + int64(self.scanp)
}
// Buffered returns a reader of the data remaining in the Decoder's buffer.
// The reader is valid until the next call to Decode.
func (self *StreamDecoder) Buffered() io.Reader {
return bytes.NewReader(self.buf[self.scanp:])
}
// More reports whether there is another element in the
// current array or object being parsed.
func (self *StreamDecoder) More() bool {
if self.err != nil {
return false
}
c, err := self.peek()
return err == nil && c != ']' && c != '}'
}
// More reports whether there is another element in the
// current array or object being parsed.
func (self *StreamDecoder) readMore() bool {
if self.err != nil {
return false
}
var err error
var n int
for {
// Grow buffer if not large enough.
l := len(self.buf)
realloc(&self.buf)
n, err = self.r.Read(self.buf[l:cap(self.buf)])
self.buf = self.buf[: l+n]
self.scanp = l
_, empty := self.scan()
if !empty {
return true
}
// buffer has been scanned, now report any error
if err != nil {
self.setErr(err)
return false
}
}
}
func (self *StreamDecoder) setErr(err error) {
self.err = err
mem := self.buf[:0]
self.buf = nil
freeBytes(mem)
}
func (self *StreamDecoder) peek() (byte, error) {
var err error
for {
c, empty := self.scan()
if !empty {
return byte(c), nil
}
// buffer has been scanned, now report any error
if err != nil {
self.setErr(err)
return 0, err
}
err = self.refill()
}
}
func (self *StreamDecoder) scan() (byte, bool) {
for i := self.scanp; i < len(self.buf); i++ {
c := self.buf[i]
if utils.IsSpace(c) {
continue
}
self.scanp = i
return c, false
}
return 0, true
}
func (self *StreamDecoder) refill() error {
// Make room to read more into the buffer.
// First slide down data already consumed.
if self.scanp > 0 {
self.scanned += int64(self.scanp)
n := copy(self.buf, self.buf[self.scanp:])
self.buf = self.buf[:n]
self.scanp = 0
}
// Grow buffer if not large enough.
realloc(&self.buf)
// Read. Delay error for next iteration (after scan).
n, err := self.r.Read(self.buf[len(self.buf):cap(self.buf)])
self.buf = self.buf[0 : len(self.buf)+n]
return err
}
func realloc(buf *[]byte) bool {
l := uint(len(*buf))
c := uint(cap(*buf))
if c == 0 {
*buf = bufPool.Get().([]byte)
return true
}
if c - l <= c >> minLeftBufferShift {
e := l+(l>>minLeftBufferShift)
if e <= c {
e = c*2
}
tmp := make([]byte, l, e)
copy(tmp, *buf)
*buf = tmp
return true
}
return false
}

View File

@@ -0,0 +1,37 @@
package consts
import (
`github.com/bytedance/sonic/internal/native/types`
)
const (
F_use_int64 = 0
F_disable_urc = 2
F_disable_unknown = 3
F_copy_string = 4
F_use_number = types.B_USE_NUMBER
F_validate_string = types.B_VALIDATE_STRING
F_allow_control = types.B_ALLOW_CONTROL
F_no_validate_json = types.B_NO_VALIDATE_JSON
F_case_sensitive = 7
)
type Options uint64
const (
OptionUseInt64 Options = 1 << F_use_int64
OptionUseNumber Options = 1 << F_use_number
OptionUseUnicodeErrors Options = 1 << F_disable_urc
OptionDisableUnknown Options = 1 << F_disable_unknown
OptionCopyString Options = 1 << F_copy_string
OptionValidateString Options = 1 << F_validate_string
OptionNoValidateJSON Options = 1 << F_no_validate_json
OptionCaseSensitive Options = 1 << F_case_sensitive
)
const (
MaxStack = 4096
)

View File

@@ -0,0 +1,191 @@
/*
* 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 errors
import (
`encoding/json`
`errors`
`fmt`
`reflect`
`strconv`
`strings`
`github.com/bytedance/sonic/internal/native/types`
`github.com/bytedance/sonic/internal/rt`
)
type SyntaxError struct {
Pos int
Src string
Code types.ParsingError
Msg string
}
func (self SyntaxError) Error() string {
return fmt.Sprintf("%q", self.Description())
}
func (self SyntaxError) Description() string {
return "Syntax error " + self.description()
}
func (self SyntaxError) description() string {
/* check for empty source */
if self.Src == "" {
return fmt.Sprintf("no sources available, the input json is empty: %#v", self)
}
p, x, q, y := calcBounds(len(self.Src), self.Pos)
/* compose the error description */
return fmt.Sprintf(
"at index %d: %s\n\n\t%s\n\t%s^%s\n",
self.Pos,
self.Message(),
self.Src[p:q],
strings.Repeat(".", x),
strings.Repeat(".", y),
)
}
func calcBounds(size int, pos int) (lbound int, lwidth int, rbound int, rwidth int) {
if pos >= size || pos < 0 {
return 0, 0, size, 0
}
i := 16
lbound = pos - i
rbound = pos + i
/* prevent slicing before the beginning */
if lbound < 0 {
lbound, rbound, i = 0, rbound - lbound, i + lbound
}
/* prevent slicing beyond the end */
if n := size; rbound > n {
n = rbound - n
rbound = size
/* move the left bound if possible */
if lbound > n {
i += n
lbound -= n
}
}
/* left and right length */
lwidth = clamp_zero(i)
rwidth = clamp_zero(rbound - lbound - i - 1)
return
}
func (self SyntaxError) Message() string {
if self.Msg == "" {
return self.Code.Message()
}
return self.Msg
}
func clamp_zero(v int) int {
if v < 0 {
return 0
} else {
return v
}
}
/** JIT Error Helpers **/
var StackOverflow = &json.UnsupportedValueError {
Str : "Value nesting too deep",
Value : reflect.ValueOf("..."),
}
func ErrorWrap(src string, pos int, code types.ParsingError) error {
return *error_wrap_heap(src, pos, code)
}
//go:noinline
func error_wrap_heap(src string, pos int, code types.ParsingError) *SyntaxError {
return &SyntaxError {
Pos : pos,
Src : src,
Code : code,
}
}
func ErrorType(vt *rt.GoType) error {
return &json.UnmarshalTypeError{Type: vt.Pack()}
}
type MismatchTypeError struct {
Pos int
Src string
Type reflect.Type
}
func swithchJSONType (src string, pos int) string {
var val string
switch src[pos] {
case 'f': fallthrough
case 't': val = "bool"
case '"': val = "string"
case '{': val = "object"
case '[': val = "array"
case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': val = "number"
}
return val
}
func (self MismatchTypeError) Error() string {
se := SyntaxError {
Pos : self.Pos,
Src : self.Src,
Code : types.ERR_MISMATCH,
}
return fmt.Sprintf("Mismatch type %s with value %s %q", self.Type.String(), swithchJSONType(self.Src, self.Pos), se.description())
}
func (self MismatchTypeError) Description() string {
se := SyntaxError {
Pos : self.Pos,
Src : self.Src,
Code : types.ERR_MISMATCH,
}
return fmt.Sprintf("Mismatch type %s with value %s %s", self.Type.String(), swithchJSONType(self.Src, self.Pos), se.description())
}
func ErrorMismatch(src string, pos int, vt *rt.GoType) error {
return &MismatchTypeError {
Pos : pos,
Src : src,
Type : vt.Pack(),
}
}
func ErrorField(name string) error {
return errors.New("json: unknown field " + strconv.Quote(name))
}
func ErrorValue(value string, vtype reflect.Type) error {
return &json.UnmarshalTypeError {
Type : vtype,
Value : value,
}
}

View File

View File

@@ -0,0 +1,121 @@
// +build go1.17,!go1.21
// Copyright 2023 CloudWeGo Authors
//
// 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 jitdec
import (
`strconv`
`unsafe`
`github.com/bytedance/sonic/internal/rt`
`github.com/bytedance/sonic/internal/jit`
`github.com/twitchyliquid64/golang-asm/obj`
`github.com/twitchyliquid64/golang-asm/obj/x86`
)
var (
_V_writeBarrier = jit.Imm(int64(uintptr(unsafe.Pointer(&rt.RuntimeWriteBarrier))))
_F_gcWriteBarrierAX = jit.Func(rt.GcWriteBarrierAX)
)
func (self *_Assembler) WritePtrAX(i int, rec obj.Addr, saveDI bool) {
self.Emit("MOVQ", _V_writeBarrier, _R9)
self.Emit("CMPL", jit.Ptr(_R9, 0), jit.Imm(0))
self.Sjmp("JE", "_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
if saveDI {
self.save(_DI)
}
self.Emit("LEAQ", rec, _DI)
self.call(_F_gcWriteBarrierAX)
if saveDI {
self.load(_DI)
}
self.Sjmp("JMP", "_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.Emit("MOVQ", _AX, rec)
self.Link("_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
}
func (self *_Assembler) WriteRecNotAX(i int, ptr obj.Addr, rec obj.Addr, saveDI bool, saveAX bool) {
if rec.Reg == x86.REG_AX || rec.Index == x86.REG_AX {
panic("rec contains AX!")
}
self.Emit("MOVQ", _V_writeBarrier, _R9)
self.Emit("CMPL", jit.Ptr(_R9, 0), jit.Imm(0))
self.Sjmp("JE", "_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
if saveAX {
self.Emit("XCHGQ", ptr, _AX)
} else {
self.Emit("MOVQ", ptr, _AX)
}
if saveDI {
self.save(_DI)
}
self.Emit("LEAQ", rec, _DI)
self.call(_F_gcWriteBarrierAX)
if saveDI {
self.load(_DI)
}
if saveAX {
self.Emit("XCHGQ", ptr, _AX)
}
self.Sjmp("JMP", "_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.Emit("MOVQ", ptr, rec)
self.Link("_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
}
func (self *_ValueDecoder) WritePtrAX(i int, rec obj.Addr, saveDI bool) {
self.Emit("MOVQ", _V_writeBarrier, _R9)
self.Emit("CMPL", jit.Ptr(_R9, 0), jit.Imm(0))
self.Sjmp("JE", "_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
if saveDI {
self.save(_DI)
}
self.Emit("LEAQ", rec, _DI)
self.call(_F_gcWriteBarrierAX)
if saveDI {
self.load(_DI)
}
self.Sjmp("JMP", "_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.Emit("MOVQ", _AX, rec)
self.Link("_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
}
func (self *_ValueDecoder) WriteRecNotAX(i int, ptr obj.Addr, rec obj.Addr, saveDI bool) {
if rec.Reg == x86.REG_AX || rec.Index == x86.REG_AX {
panic("rec contains AX!")
}
self.Emit("MOVQ", _V_writeBarrier, _AX)
self.Emit("CMPL", jit.Ptr(_AX, 0), jit.Imm(0))
self.Sjmp("JE", "_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.Emit("MOVQ", ptr, _AX)
if saveDI {
self.save(_DI)
}
self.Emit("LEAQ", rec, _DI)
self.call(_F_gcWriteBarrierAX)
if saveDI {
self.load(_DI)
}
self.Sjmp("JMP", "_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.Emit("MOVQ", ptr, rec)
self.Link("_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
}

View File

@@ -0,0 +1,126 @@
// +build go1.21,!go1.27
// Copyright 2023 CloudWeGo Authors
//
// 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 jitdec
import (
`strconv`
`unsafe`
`github.com/bytedance/sonic/internal/rt`
`github.com/bytedance/sonic/internal/jit`
`github.com/twitchyliquid64/golang-asm/obj`
`github.com/twitchyliquid64/golang-asm/obj/x86`
)
// Notice: gcWriteBarrier must use R11 register!!
var _R11 = _IC
var (
_V_writeBarrier = jit.Imm(int64(uintptr(unsafe.Pointer(&rt.RuntimeWriteBarrier))))
_F_gcWriteBarrier2 = jit.Func(rt.GcWriteBarrier2)
)
func (self *_Assembler) WritePtrAX(i int, rec obj.Addr, saveDI bool) {
self.Emit("MOVQ", _V_writeBarrier, _R9)
self.Emit("CMPL", jit.Ptr(_R9, 0), jit.Imm(0))
self.Sjmp("JE", "_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
if saveDI {
self.save(_DI, _R11)
} else {
self.save(_R11)
}
self.Emit("MOVQ", _F_gcWriteBarrier2, _R11)
self.Rjmp("CALL", _R11)
self.Emit("MOVQ", _AX, jit.Ptr(_R11, 0))
self.Emit("MOVQ", rec, _DI)
self.Emit("MOVQ", _DI, jit.Ptr(_R11, 8))
if saveDI {
self.load(_DI, _R11)
} else {
self.load(_R11)
}
self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.Emit("MOVQ", _AX, rec)
}
func (self *_Assembler) WriteRecNotAX(i int, ptr obj.Addr, rec obj.Addr, saveDI bool, saveAX bool) {
if rec.Reg == x86.REG_AX || rec.Index == x86.REG_AX {
panic("rec contains AX!")
}
self.Emit("MOVQ", _V_writeBarrier, _R9)
self.Emit("CMPL", jit.Ptr(_R9, 0), jit.Imm(0))
self.Sjmp("JE", "_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
if saveAX {
self.save(_AX, _R11)
} else {
self.save(_R11)
}
self.Emit("MOVQ", _F_gcWriteBarrier2, _R11)
self.Rjmp("CALL", _R11)
self.Emit("MOVQ", ptr, jit.Ptr(_R11, 0))
self.Emit("MOVQ", rec, _AX)
self.Emit("MOVQ", _AX, jit.Ptr(_R11, 8))
if saveAX {
self.load(_AX, _R11)
} else {
self.load(_R11)
}
self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.Emit("MOVQ", ptr, rec)
}
func (self *_ValueDecoder) WritePtrAX(i int, rec obj.Addr, saveDI bool) {
self.Emit("MOVQ", _V_writeBarrier, _R9)
self.Emit("CMPL", jit.Ptr(_R9, 0), jit.Imm(0))
self.Sjmp("JE", "_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
if saveDI {
self.save(_DI, _R11)
} else {
self.save(_R11)
}
self.Emit("MOVQ", _F_gcWriteBarrier2, _R11)
self.Rjmp("CALL", _R11)
self.Emit("MOVQ", _AX, jit.Ptr(_R11, 0))
self.Emit("MOVQ", rec, _DI)
self.Emit("MOVQ", _DI, jit.Ptr(_R11, 8))
if saveDI {
self.load(_DI, _R11)
} else {
self.load(_R11)
}
self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.Emit("MOVQ", _AX, rec)
}
func (self *_ValueDecoder) WriteRecNotAX(i int, ptr obj.Addr, rec obj.Addr, saveDI bool) {
if rec.Reg == x86.REG_AX || rec.Index == x86.REG_AX {
panic("rec contains AX!")
}
self.Emit("MOVQ", _V_writeBarrier, _AX)
self.Emit("CMPL", jit.Ptr(_AX, 0), jit.Imm(0))
self.Sjmp("JE", "_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.save(_R11)
self.Emit("MOVQ", _F_gcWriteBarrier2, _R11)
self.Rjmp("CALL", _R11)
self.Emit("MOVQ", ptr, jit.Ptr(_R11, 0))
self.Emit("MOVQ", rec, _AX)
self.Emit("MOVQ", _AX, jit.Ptr(_R11, 8))
self.load(_R11)
self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.Emit("MOVQ", ptr, rec)
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,70 @@
/*
* 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 jitdec
import (
`os`
`runtime`
`runtime/debug`
`strings`
`github.com/bytedance/sonic/internal/jit`
)
var (
debugSyncGC = os.Getenv("SONIC_SYNC_GC") != ""
debugAsyncGC = os.Getenv("SONIC_NO_ASYNC_GC") == ""
)
var (
_Instr_End _Instr = newInsOp(_OP_nil_1)
_F_gc = jit.Func(runtime.GC)
_F_force_gc = jit.Func(debug.FreeOSMemory)
_F_println = jit.Func(println_wrapper)
_F_print = jit.Func(print)
)
func println_wrapper(i int, op1 int, op2 int){
println(i, " Intrs ", op1, _OpNames[op1], "next: ", op2, _OpNames[op2])
}
func print(i int){
println(i)
}
func (self *_Assembler) force_gc() {
self.call_go(_F_gc)
self.call_go(_F_force_gc)
}
func (self *_Assembler) debug_instr(i int, v *_Instr) {
if debugSyncGC {
if (i+1 == len(self.p)) {
self.print_gc(i, v, &_Instr_End)
} else {
next := &(self.p[i+1])
self.print_gc(i, v, next)
name := _OpNames[next.op()]
if strings.Contains(name, "save") {
return
}
}
self.force_gc()
}
}

View File

@@ -0,0 +1,141 @@
package jitdec
import (
`unsafe`
`encoding/json`
`reflect`
`runtime`
`github.com/bytedance/sonic/internal/decoder/consts`
`github.com/bytedance/sonic/internal/decoder/errors`
`github.com/bytedance/sonic/internal/rt`
`github.com/bytedance/sonic/utf8`
`github.com/bytedance/sonic/option`
)
type (
MismatchTypeError = errors.MismatchTypeError
SyntaxError = errors.SyntaxError
)
const (
_F_allow_control = consts.F_allow_control
_F_copy_string = consts.F_copy_string
_F_disable_unknown = consts.F_disable_unknown
_F_disable_urc = consts.F_disable_urc
_F_use_int64 = consts.F_use_int64
_F_use_number = consts.F_use_number
_F_no_validate_json = consts.F_no_validate_json
_F_validate_string = consts.F_validate_string
_F_case_sensitive = consts.F_case_sensitive
)
var (
error_wrap = errors.ErrorWrap
error_type = errors.ErrorType
error_field = errors.ErrorField
error_value = errors.ErrorValue
error_mismatch = errors.ErrorMismatch
stackOverflow = errors.StackOverflow
)
// Decode parses the JSON-encoded data from current position and stores the result
// in the value pointed to by val.
func Decode(s *string, i *int, f uint64, val interface{}) error {
/* validate json if needed */
if (f & (1 << _F_validate_string)) != 0 && !utf8.ValidateString(*s){
dbuf := utf8.CorrectWith(nil, rt.Str2Mem(*s), "\ufffd")
*s = rt.Mem2Str(dbuf)
}
vv := rt.UnpackEface(val)
vp := vv.Value
/* check for nil type */
if vv.Type == nil {
return &json.InvalidUnmarshalError{}
}
/* must be a non-nil pointer */
if vp == nil || vv.Type.Kind() != reflect.Ptr {
return &json.InvalidUnmarshalError{Type: vv.Type.Pack()}
}
etp := rt.PtrElem(vv.Type)
/* check the defined pointer type for issue 379 */
if vv.Type.IsNamed() {
newp := vp
etp = vv.Type
vp = unsafe.Pointer(&newp)
}
/* create a new stack, and call the decoder */
sb := newStack()
nb, err := decodeTypedPointer(*s, *i, etp, vp, sb, f)
/* return the stack back */
*i = nb
freeStack(sb)
/* avoid GC ahead */
runtime.KeepAlive(vv)
return err
}
// Pretouch compiles vt ahead-of-time to avoid JIT compilation on-the-fly, in
// order to reduce the first-hit latency.
//
// 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.
func Pretouch(vt reflect.Type, opts ...option.CompileOption) error {
cfg := option.DefaultCompileOptions()
for _, opt := range opts {
opt(&cfg)
}
return pretouchRec(map[reflect.Type]bool{vt:true}, cfg)
}
func pretouchType(_vt reflect.Type, opts option.CompileOptions) (map[reflect.Type]bool, error) {
/* compile function */
compiler := newCompiler().apply(opts)
decoder := func(vt *rt.GoType, _ ...interface{}) (interface{}, error) {
if pp, err := compiler.compile(_vt); err != nil {
return nil, err
} else {
as := newAssembler(pp)
as.name = _vt.String()
return as.Load(), nil
}
}
/* find or compile */
vt := rt.UnpackType(_vt)
if val := programCache.Get(vt); val != nil {
return nil, nil
} else if _, err := programCache.Compute(vt, decoder); err == nil {
return compiler.rec, nil
} else {
return nil, err
}
}
func pretouchRec(vtm map[reflect.Type]bool, opts option.CompileOptions) error {
if opts.RecursiveDepth < 0 || len(vtm) == 0 {
return nil
}
next := make(map[reflect.Type]bool)
for vt := range(vtm) {
sub, err := pretouchType(vt, opts)
if err != nil {
return err
}
for svt := range(sub) {
next[svt] = true
}
}
opts.RecursiveDepth -= 1
return pretouchRec(next, opts)
}

View File

@@ -0,0 +1,730 @@
// +build go1.17,!go1.27
/*
* 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 jitdec
import (
`encoding/json`
`fmt`
`reflect`
`github.com/bytedance/sonic/internal/jit`
`github.com/bytedance/sonic/internal/native`
`github.com/bytedance/sonic/internal/native/types`
`github.com/twitchyliquid64/golang-asm/obj`
`github.com/bytedance/sonic/internal/rt`
)
/** Crucial Registers:
*
* ST(R13) && 0(SP) : ro, decoder stack
* DF(AX) : ro, decoder flags
* EP(BX) : wo, error pointer
* IP(R10) : ro, input pointer
* IL(R12) : ro, input length
* IC(R11) : rw, input cursor
* VP(R15) : ro, value pointer (to an interface{})
*/
const (
_VD_args = 8 // 8 bytes for passing arguments to this functions
_VD_fargs = 64 // 64 bytes for passing arguments to other Go functions
_VD_saves = 48 // 48 bytes for saving the registers before CALL instructions
_VD_locals = 96 // 96 bytes for local variables
)
const (
_VD_offs = _VD_fargs + _VD_saves + _VD_locals
_VD_size = _VD_offs + 8 // 8 bytes for the parent frame pointer
)
var (
_VAR_ss = _VAR_ss_Vt
_VAR_df = jit.Ptr(_SP, _VD_fargs + _VD_saves)
)
var (
_VAR_ss_Vt = jit.Ptr(_SP, _VD_fargs + _VD_saves + 8)
_VAR_ss_Dv = jit.Ptr(_SP, _VD_fargs + _VD_saves + 16)
_VAR_ss_Iv = jit.Ptr(_SP, _VD_fargs + _VD_saves + 24)
_VAR_ss_Ep = jit.Ptr(_SP, _VD_fargs + _VD_saves + 32)
_VAR_ss_Db = jit.Ptr(_SP, _VD_fargs + _VD_saves + 40)
_VAR_ss_Dc = jit.Ptr(_SP, _VD_fargs + _VD_saves + 48)
)
var (
_VAR_R9 = jit.Ptr(_SP, _VD_fargs + _VD_saves + 56)
)
type _ValueDecoder struct {
jit.BaseAssembler
}
var (
_VAR_cs_LR = jit.Ptr(_SP, _VD_fargs + _VD_saves + 64)
_VAR_cs_p = jit.Ptr(_SP, _VD_fargs + _VD_saves + 72)
_VAR_cs_n = jit.Ptr(_SP, _VD_fargs + _VD_saves + 80)
_VAR_cs_d = jit.Ptr(_SP, _VD_fargs + _VD_saves + 88)
)
func (self *_ValueDecoder) build() uintptr {
self.Init(self.compile)
return *(*uintptr)(self.Load("decode_value", _VD_size, _VD_args, argPtrs_generic, localPtrs_generic))
}
/** Function Calling Helpers **/
func (self *_ValueDecoder) save(r ...obj.Addr) {
for i, v := range r {
if i > _VD_saves / 8 - 1 {
panic("too many registers to save")
} else {
self.Emit("MOVQ", v, jit.Ptr(_SP, _VD_fargs + int64(i) * 8))
}
}
}
func (self *_ValueDecoder) load(r ...obj.Addr) {
for i, v := range r {
if i > _VD_saves / 8 - 1 {
panic("too many registers to load")
} else {
self.Emit("MOVQ", jit.Ptr(_SP, _VD_fargs + int64(i) * 8), v)
}
}
}
func (self *_ValueDecoder) call(fn obj.Addr) {
self.Emit("MOVQ", fn, _R9) // MOVQ ${fn}, AX
self.Rjmp("CALL", _R9) // CALL AX
}
func (self *_ValueDecoder) call_go(fn obj.Addr) {
self.save(_REG_go...) // SAVE $REG_go
self.call(fn) // CALL ${fn}
self.load(_REG_go...) // LOAD $REG_go
}
func (self *_ValueDecoder) callc(fn obj.Addr) {
self.save(_IP)
self.call(fn)
self.load(_IP)
}
func (self *_ValueDecoder) call_c(fn obj.Addr) {
self.Emit("XCHGQ", _IC, _BX)
self.callc(fn)
self.Emit("XCHGQ", _IC, _BX)
}
/** Decoder Assembler **/
const (
_S_val = iota + 1
_S_arr
_S_arr_0
_S_obj
_S_obj_0
_S_obj_delim
_S_obj_sep
)
const (
_S_omask_key = (1 << _S_obj_0) | (1 << _S_obj_sep)
_S_omask_end = (1 << _S_obj_0) | (1 << _S_obj)
_S_vmask = (1 << _S_val) | (1 << _S_arr_0)
)
const (
_A_init_len = 1
_A_init_cap = 16
)
const (
_ST_Sp = 0
_ST_Vt = _PtrBytes
_ST_Vp = _PtrBytes * (types.MAX_RECURSE + 1)
)
var (
_V_true = jit.Imm(int64(pbool(true)))
_V_false = jit.Imm(int64(pbool(false)))
_F_value = jit.Imm(int64(native.S_value))
)
var (
_V_max = jit.Imm(int64(types.V_MAX))
_E_eof = jit.Imm(int64(types.ERR_EOF))
_E_invalid = jit.Imm(int64(types.ERR_INVALID_CHAR))
_E_recurse = jit.Imm(int64(types.ERR_RECURSE_EXCEED_MAX))
)
var (
_F_convTslice = jit.Func(rt.ConvTslice)
_F_convTstring = jit.Func(rt.ConvTstring)
_F_invalid_vtype = jit.Func(invalid_vtype)
)
var (
_T_map = jit.Type(reflect.TypeOf((map[string]interface{})(nil)))
_T_bool = jit.Type(reflect.TypeOf(false))
_T_int64 = jit.Type(reflect.TypeOf(int64(0)))
_T_eface = jit.Type(reflect.TypeOf((*interface{})(nil)).Elem())
_T_slice = jit.Type(reflect.TypeOf(([]interface{})(nil)))
_T_string = jit.Type(reflect.TypeOf(""))
_T_number = jit.Type(reflect.TypeOf(json.Number("")))
_T_float64 = jit.Type(reflect.TypeOf(float64(0)))
)
var _R_tab = map[int]string {
'[': "_decode_V_ARRAY",
'{': "_decode_V_OBJECT",
':': "_decode_V_KEY_SEP",
',': "_decode_V_ELEM_SEP",
']': "_decode_V_ARRAY_END",
'}': "_decode_V_OBJECT_END",
}
func (self *_ValueDecoder) compile() {
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
/* initialize the state machine */
self.Emit("XORL", _CX, _CX) // XORL CX, CX
self.Emit("MOVQ", _DF, _VAR_df) // MOVQ DF, df
/* initialize digital buffer first */
self.Emit("MOVQ", jit.Imm(_MaxDigitNums), _VAR_ss_Dc) // MOVQ $_MaxDigitNums, ss.Dcap
self.Emit("LEAQ", jit.Ptr(_ST, _DbufOffset), _AX) // LEAQ _DbufOffset(ST), AX
self.Emit("MOVQ", _AX, _VAR_ss_Db) // MOVQ AX, ss.Dbuf
/* add ST offset */
self.Emit("ADDQ", jit.Imm(_FsmOffset), _ST) // ADDQ _FsmOffset, _ST
self.Emit("MOVQ", _CX, jit.Ptr(_ST, _ST_Sp)) // MOVQ CX, ST.Sp
self.WriteRecNotAX(0, _VP, jit.Ptr(_ST, _ST_Vp), false) // MOVQ VP, ST.Vp[0]
self.Emit("MOVQ", jit.Imm(_S_val), jit.Ptr(_ST, _ST_Vt)) // MOVQ _S_val, ST.Vt[0]
self.Sjmp("JMP" , "_next") // JMP _next
/* set the value from previous round */
self.Link("_set_value") // _set_value:
self.Emit("MOVL" , jit.Imm(_S_vmask), _DX) // MOVL _S_vmask, DX
self.Emit("MOVQ" , jit.Ptr(_ST, _ST_Sp), _CX) // MOVQ ST.Sp, CX
self.Emit("MOVQ" , jit.Sib(_ST, _CX, 8, _ST_Vt), _AX) // MOVQ ST.Vt[CX], AX
self.Emit("BTQ" , _AX, _DX) // BTQ AX, DX
self.Sjmp("JNC" , "_vtype_error") // JNC _vtype_error
self.Emit("XORL" , _SI, _SI) // XORL SI, SI
self.Emit("SUBQ" , jit.Imm(1), jit.Ptr(_ST, _ST_Sp)) // SUBQ $1, ST.Sp
self.Emit("XCHGQ", jit.Sib(_ST, _CX, 8, _ST_Vp), _SI) // XCHGQ ST.Vp[CX], SI
self.Emit("MOVQ" , _R8, jit.Ptr(_SI, 0)) // MOVQ R8, (SI)
self.WriteRecNotAX(1, _R9, jit.Ptr(_SI, 8), false) // MOVQ R9, 8(SI)
/* check for value stack */
self.Link("_next") // _next:
self.Emit("MOVQ" , jit.Ptr(_ST, _ST_Sp), _AX) // MOVQ ST.Sp, AX
self.Emit("TESTQ", _AX, _AX) // TESTQ AX, AX
self.Sjmp("JS" , "_return") // JS _return
/* fast path: test up to 4 characters manually */
self.Emit("CMPQ" , _IC, _IL) // CMPQ IC, IL
self.Sjmp("JAE" , "_decode_V_EOF") // JAE _decode_V_EOF
self.Emit("MOVBQZX", jit.Sib(_IP, _IC, 1, 0), _AX) // MOVBQZX (IP)(IC), AX
self.Emit("MOVQ" , jit.Imm(_BM_space), _DX) // MOVQ _BM_space, DX
self.Emit("CMPQ" , _AX, jit.Imm(' ')) // CMPQ AX, $' '
self.Sjmp("JA" , "_decode_fast") // JA _decode_fast
self.Emit("BTQ" , _AX, _DX) // BTQ _AX, _DX
self.Sjmp("JNC" , "_decode_fast") // JNC _decode_fast
self.Emit("ADDQ" , jit.Imm(1), _IC) // ADDQ $1, IC
/* at least 1 to 3 spaces */
for i := 0; i < 3; i++ {
self.Emit("CMPQ" , _IC, _IL) // CMPQ IC, IL
self.Sjmp("JAE" , "_decode_V_EOF") // JAE _decode_V_EOF
self.Emit("MOVBQZX", jit.Sib(_IP, _IC, 1, 0), _AX) // MOVBQZX (IP)(IC), AX
self.Emit("CMPQ" , _AX, jit.Imm(' ')) // CMPQ AX, $' '
self.Sjmp("JA" , "_decode_fast") // JA _decode_fast
self.Emit("BTQ" , _AX, _DX) // BTQ _AX, _DX
self.Sjmp("JNC" , "_decode_fast") // JNC _decode_fast
self.Emit("ADDQ" , jit.Imm(1), _IC) // ADDQ $1, IC
}
/* at least 4 spaces */
self.Emit("CMPQ" , _IC, _IL) // CMPQ IC, IL
self.Sjmp("JAE" , "_decode_V_EOF") // JAE _decode_V_EOF
self.Emit("MOVBQZX", jit.Sib(_IP, _IC, 1, 0), _AX) // MOVBQZX (IP)(IC), AX
/* fast path: use lookup table to select decoder */
self.Link("_decode_fast") // _decode_fast:
self.Byte(0x48, 0x8d, 0x3d) // LEAQ ?(PC), DI
self.Sref("_decode_tab", 4) // .... &_decode_tab
self.Emit("MOVLQSX", jit.Sib(_DI, _AX, 4, 0), _AX) // MOVLQSX (DI)(AX*4), AX
self.Emit("TESTQ" , _AX, _AX) // TESTQ AX, AX
self.Sjmp("JZ" , "_decode_native") // JZ _decode_native
self.Emit("ADDQ" , jit.Imm(1), _IC) // ADDQ $1, IC
self.Emit("ADDQ" , _DI, _AX) // ADDQ DI, AX
self.Rjmp("JMP" , _AX) // JMP AX
/* decode with native decoder */
self.Link("_decode_native") // _decode_native:
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_ss, _CX) // LEAQ ss, CX
self.Emit("MOVQ", _VAR_df, _R8) // MOVQ $df, R8
self.Emit("BTSQ", jit.Imm(_F_allow_control), _R8) // ANDQ $1<<_F_allow_control, R8
self.callc(_F_value) // CALL value
self.Emit("MOVQ", _AX, _IC) // MOVQ AX, IC
/* check for errors */
self.Emit("MOVQ" , _VAR_ss_Vt, _AX) // MOVQ ss.Vt, AX
self.Emit("TESTQ", _AX, _AX) // TESTQ AX, AX
self.Sjmp("JS" , "_parsing_error")
self.Sjmp("JZ" , "_invalid_vtype") // JZ _invalid_vtype
self.Emit("CMPQ" , _AX, _V_max) // CMPQ AX, _V_max
self.Sjmp("JA" , "_invalid_vtype") // JA _invalid_vtype
/* jump table selector */
self.Byte(0x48, 0x8d, 0x3d) // LEAQ ?(PC), DI
self.Sref("_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_EOF **/
self.Link("_decode_V_EOF") // _decode_V_EOF:
self.Emit("MOVL", _E_eof, _EP) // MOVL _E_eof, EP
self.Sjmp("JMP" , "_error") // JMP _error
/** V_NULL **/
self.Link("_decode_V_NULL") // _decode_V_NULL:
self.Emit("XORL", _R8, _R8) // XORL R8, R8
self.Emit("XORL", _R9, _R9) // XORL R9, R9
self.Emit("LEAQ", jit.Ptr(_IC, -4), _DI) // LEAQ -4(IC), DI
self.Sjmp("JMP" , "_set_value") // JMP _set_value
/** V_TRUE **/
self.Link("_decode_V_TRUE") // _decode_V_TRUE:
self.Emit("MOVQ", _T_bool, _R8) // MOVQ _T_bool, R8
// TODO: maybe modified by users?
self.Emit("MOVQ", _V_true, _R9) // MOVQ _V_true, R9
self.Emit("LEAQ", jit.Ptr(_IC, -4), _DI) // LEAQ -4(IC), DI
self.Sjmp("JMP" , "_set_value") // JMP _set_value
/** V_FALSE **/
self.Link("_decode_V_FALSE") // _decode_V_FALSE:
self.Emit("MOVQ", _T_bool, _R8) // MOVQ _T_bool, R8
self.Emit("MOVQ", _V_false, _R9) // MOVQ _V_false, R9
self.Emit("LEAQ", jit.Ptr(_IC, -5), _DI) // LEAQ -5(IC), DI
self.Sjmp("JMP" , "_set_value") // JMP _set_value
/** V_ARRAY **/
self.Link("_decode_V_ARRAY") // _decode_V_ARRAY
self.Emit("MOVL", jit.Imm(_S_vmask), _DX) // MOVL _S_vmask, DX
self.Emit("MOVQ", jit.Ptr(_ST, _ST_Sp), _CX) // MOVQ ST.Sp, CX
self.Emit("MOVQ", jit.Sib(_ST, _CX, 8, _ST_Vt), _AX) // MOVQ ST.Vt[CX], AX
self.Emit("BTQ" , _AX, _DX) // BTQ AX, DX
self.Sjmp("JNC" , "_invalid_char") // JNC _invalid_char
/* create a new array */
self.Emit("MOVQ", _T_eface, _AX) // MOVQ _T_eface, AX
self.Emit("MOVQ", jit.Imm(_A_init_len), _BX) // MOVQ _A_init_len, BX
self.Emit("MOVQ", jit.Imm(_A_init_cap), _CX) // MOVQ _A_init_cap, CX
self.call_go(_F_makeslice) // CALL_GO runtime.makeslice
/* pack into an interface */
self.Emit("MOVQ", jit.Imm(_A_init_len), _BX) // MOVQ _A_init_len, BX
self.Emit("MOVQ", jit.Imm(_A_init_cap), _CX) // MOVQ _A_init_cap, CX
self.call_go(_F_convTslice) // CALL_GO runtime.convTslice
self.Emit("MOVQ", _AX, _R8) // MOVQ AX, R8
/* replace current state with an array */
self.Emit("MOVQ", jit.Ptr(_ST, _ST_Sp), _CX) // MOVQ ST.Sp, CX
self.Emit("MOVQ", jit.Sib(_ST, _CX, 8, _ST_Vp), _SI) // MOVQ ST.Vp[CX], SI
self.Emit("MOVQ", jit.Imm(_S_arr), jit.Sib(_ST, _CX, 8, _ST_Vt)) // MOVQ _S_arr, ST.Vt[CX]
self.Emit("MOVQ", _T_slice, _AX) // MOVQ _T_slice, AX
self.Emit("MOVQ", _AX, jit.Ptr(_SI, 0)) // MOVQ AX, (SI)
self.WriteRecNotAX(2, _R8, jit.Ptr(_SI, 8), false) // MOVQ R8, 8(SI)
/* add a new slot for the first element */
self.Emit("ADDQ", jit.Imm(1), _CX) // ADDQ $1, CX
self.Emit("CMPQ", _CX, jit.Imm(types.MAX_RECURSE)) // CMPQ CX, ${types.MAX_RECURSE}
self.Sjmp("JAE" , "_stack_overflow") // JA _stack_overflow
self.Emit("MOVQ", jit.Ptr(_R8, 0), _AX) // MOVQ (R8), AX
self.Emit("MOVQ", _CX, jit.Ptr(_ST, _ST_Sp)) // MOVQ CX, ST.Sp
self.WritePtrAX(3, jit.Sib(_ST, _CX, 8, _ST_Vp), false) // MOVQ AX, ST.Vp[CX]
self.Emit("MOVQ", jit.Imm(_S_arr_0), jit.Sib(_ST, _CX, 8, _ST_Vt)) // MOVQ _S_arr_0, ST.Vt[CX]
self.Sjmp("JMP" , "_next") // JMP _next
/** V_OBJECT **/
self.Link("_decode_V_OBJECT") // _decode_V_OBJECT:
self.Emit("MOVL", jit.Imm(_S_vmask), _DX) // MOVL _S_vmask, DX
self.Emit("MOVQ", jit.Ptr(_ST, _ST_Sp), _CX) // MOVQ ST.Sp, CX
self.Emit("MOVQ", jit.Sib(_ST, _CX, 8, _ST_Vt), _AX) // MOVQ ST.Vt[CX], AX
self.Emit("BTQ" , _AX, _DX) // BTQ AX, DX
self.Sjmp("JNC" , "_invalid_char") // JNC _invalid_char
self.call_go(_F_makemap_small) // CALL_GO runtime.makemap_small
self.Emit("MOVQ", jit.Ptr(_ST, _ST_Sp), _CX) // MOVQ ST.Sp, CX
self.Emit("MOVQ", jit.Imm(_S_obj_0), jit.Sib(_ST, _CX, 8, _ST_Vt)) // MOVQ _S_obj_0, ST.Vt[CX]
self.Emit("MOVQ", jit.Sib(_ST, _CX, 8, _ST_Vp), _SI) // MOVQ ST.Vp[CX], SI
self.Emit("MOVQ", _T_map, _DX) // MOVQ _T_map, DX
self.Emit("MOVQ", _DX, jit.Ptr(_SI, 0)) // MOVQ DX, (SI)
self.WritePtrAX(4, jit.Ptr(_SI, 8), false) // MOVQ AX, 8(SI)
self.Sjmp("JMP" , "_next") // JMP _next
/** V_STRING **/
self.Link("_decode_V_STRING") // _decode_V_STRING:
self.Emit("MOVQ", _VAR_ss_Iv, _CX) // MOVQ ss.Iv, CX
self.Emit("MOVQ", _IC, _AX) // MOVQ IC, AX
self.Emit("SUBQ", _CX, _AX) // SUBQ CX, AX
/* check for escapes */
self.Emit("CMPQ", _VAR_ss_Ep, jit.Imm(-1)) // CMPQ ss.Ep, $-1
self.Sjmp("JNE" , "_unquote") // JNE _unquote
self.Emit("SUBQ", jit.Imm(1), _AX) // SUBQ $1, AX
self.Emit("LEAQ", jit.Sib(_IP, _CX, 1, 0), _R8) // LEAQ (IP)(CX), R8
self.Byte(0x48, 0x8d, 0x3d) // LEAQ (PC), DI
self.Sref("_copy_string_end", 4)
self.Emit("BTQ", jit.Imm(_F_copy_string), _VAR_df)
self.Sjmp("JC", "copy_string")
self.Link("_copy_string_end")
self.Emit("XORL", _DX, _DX)
/* strings with no escape sequences */
self.Link("_noescape") // _noescape:
self.Emit("MOVL", jit.Imm(_S_omask_key), _DI) // MOVL _S_omask, DI
self.Emit("MOVQ", jit.Ptr(_ST, _ST_Sp), _CX) // MOVQ ST.Sp, CX
self.Emit("MOVQ", jit.Sib(_ST, _CX, 8, _ST_Vt), _SI) // MOVQ ST.Vt[CX], SI
self.Emit("BTQ" , _SI, _DI) // BTQ SI, DI
self.Sjmp("JC" , "_object_key") // JC _object_key
/* check for pre-packed strings, avoid 1 allocation */
self.Emit("TESTQ", _DX, _DX) // TESTQ DX, DX
self.Sjmp("JNZ" , "_packed_str") // JNZ _packed_str
self.Emit("MOVQ" , _AX, _BX) // MOVQ AX, BX
self.Emit("MOVQ" , _R8, _AX) // MOVQ R8, AX
self.call_go(_F_convTstring) // CALL_GO runtime.convTstring
self.Emit("MOVQ" , _AX, _R9) // MOVQ AX, R9
/* packed string already in R9 */
self.Link("_packed_str") // _packed_str:
self.Emit("MOVQ", _T_string, _R8) // MOVQ _T_string, R8
self.Emit("MOVQ", _VAR_ss_Iv, _DI) // MOVQ ss.Iv, DI
self.Emit("SUBQ", jit.Imm(1), _DI) // SUBQ $1, DI
self.Sjmp("JMP" , "_set_value") // JMP _set_value
/* the string is an object key, get the map */
self.Link("_object_key")
self.Emit("MOVQ", jit.Ptr(_ST, _ST_Sp), _CX) // MOVQ ST.Sp, CX
self.Emit("MOVQ", jit.Sib(_ST, _CX, 8, _ST_Vp), _SI) // MOVQ ST.Vp[CX], SI
self.Emit("MOVQ", jit.Ptr(_SI, 8), _SI) // MOVQ 8(SI), SI
/* add a new delimiter */
self.Emit("ADDQ", jit.Imm(1), _CX) // ADDQ $1, CX
self.Emit("CMPQ", _CX, jit.Imm(types.MAX_RECURSE)) // CMPQ CX, ${types.MAX_RECURSE}
self.Sjmp("JAE" , "_stack_overflow") // JA _stack_overflow
self.Emit("MOVQ", _CX, jit.Ptr(_ST, _ST_Sp)) // MOVQ CX, ST.Sp
self.Emit("MOVQ", jit.Imm(_S_obj_delim), jit.Sib(_ST, _CX, 8, _ST_Vt)) // MOVQ _S_obj_delim, ST.Vt[CX]
/* add a new slot int the map */
self.Emit("MOVQ", _AX, _DI) // MOVQ AX, DI
self.Emit("MOVQ", _T_map, _AX) // MOVQ _T_map, AX
self.Emit("MOVQ", _SI, _BX) // MOVQ SI, BX
self.Emit("MOVQ", _R8, _CX) // MOVQ R9, CX
self.call_go(_F_mapassign_faststr) // CALL_GO runtime.mapassign_faststr
/* add to the pointer stack */
self.Emit("MOVQ", jit.Ptr(_ST, _ST_Sp), _CX) // MOVQ ST.Sp, CX
self.WritePtrAX(6, jit.Sib(_ST, _CX, 8, _ST_Vp), false) // MOVQ AX, ST.Vp[CX]
self.Sjmp("JMP" , "_next") // JMP _next
/* allocate memory to store the string header and unquoted result */
self.Link("_unquote") // _unquote:
self.Emit("ADDQ", jit.Imm(15), _AX) // ADDQ $15, AX
self.Emit("MOVQ", _T_byte, _BX) // MOVQ _T_byte, BX
self.Emit("MOVB", jit.Imm(0), _CX) // MOVB $0, CX
self.call_go(_F_mallocgc) // CALL_GO runtime.mallocgc
self.Emit("MOVQ", _AX, _R9) // MOVQ AX, R9
/* prepare the unquoting parameters */
self.Emit("MOVQ" , _VAR_ss_Iv, _CX) // MOVQ ss.Iv, CX
self.Emit("LEAQ" , jit.Sib(_IP, _CX, 1, 0), _DI) // LEAQ (IP)(CX), DI
self.Emit("NEGQ" , _CX) // NEGQ CX
self.Emit("LEAQ" , jit.Sib(_IC, _CX, 1, -1), _SI) // LEAQ -1(IC)(CX), SI
self.Emit("LEAQ" , jit.Ptr(_R9, 16), _DX) // LEAQ 16(R8), DX
self.Emit("LEAQ" , _VAR_ss_Ep, _CX) // LEAQ ss.Ep, CX
self.Emit("XORL" , _R8, _R8) // XORL R8, R8
self.Emit("BTQ" , jit.Imm(_F_disable_urc), _VAR_df) // BTQ ${_F_disable_urc}, fv
self.Emit("SETCC", _R8) // SETCC R8
self.Emit("SHLQ" , jit.Imm(types.B_UNICODE_REPLACE), _R8) // SHLQ ${types.B_UNICODE_REPLACE}, R8
/* unquote the string, with R9 been preserved */
self.Emit("MOVQ", _R9, _VAR_R9) // SAVE R9
self.call_c(_F_unquote) // CALL unquote
self.Emit("MOVQ", _VAR_R9, _R9) // LOAD R9
/* check for errors */
self.Emit("TESTQ", _AX, _AX) // TESTQ AX, AX
self.Sjmp("JS" , "_unquote_error") // JS _unquote_error
self.Emit("MOVL" , jit.Imm(1), _DX) // MOVL $1, DX
self.Emit("LEAQ" , jit.Ptr(_R9, 16), _R8) // ADDQ $16, R8
self.Emit("MOVQ" , _R8, jit.Ptr(_R9, 0)) // MOVQ R8, (R9)
self.Emit("MOVQ" , _AX, jit.Ptr(_R9, 8)) // MOVQ AX, 8(R9)
self.Sjmp("JMP" , "_noescape") // JMP _noescape
/** V_DOUBLE **/
self.Link("_decode_V_DOUBLE") // _decode_V_DOUBLE:
self.Emit("BTQ" , jit.Imm(_F_use_number), _VAR_df) // BTQ _F_use_number, df
self.Sjmp("JC" , "_use_number") // JC _use_number
self.Emit("MOVSD", _VAR_ss_Dv, _X0) // MOVSD ss.Dv, X0
self.Sjmp("JMP" , "_use_float64") // JMP _use_float64
/** V_INTEGER **/
self.Link("_decode_V_INTEGER") // _decode_V_INTEGER:
self.Emit("BTQ" , jit.Imm(_F_use_number), _VAR_df) // BTQ _F_use_number, df
self.Sjmp("JC" , "_use_number") // JC _use_number
self.Emit("BTQ" , jit.Imm(_F_use_int64), _VAR_df) // BTQ _F_use_int64, df
self.Sjmp("JC" , "_use_int64") // JC _use_int64
//TODO: use ss.Dv directly
self.Emit("MOVSD", _VAR_ss_Dv, _X0) // MOVSD ss.Dv, X0
/* represent numbers as `float64` */
self.Link("_use_float64") // _use_float64:
self.Emit("MOVQ" , _X0, _AX) // MOVQ X0, AX
self.call_go(_F_convT64) // CALL_GO runtime.convT64
self.Emit("MOVQ" , _T_float64, _R8) // MOVQ _T_float64, R8
self.Emit("MOVQ" , _AX, _R9) // MOVQ AX, R9
self.Emit("MOVQ" , _VAR_ss_Ep, _DI) // MOVQ ss.Ep, DI
self.Sjmp("JMP" , "_set_value") // JMP _set_value
/* represent numbers as `json.Number` */
self.Link("_use_number") // _use_number
self.Emit("MOVQ", _VAR_ss_Ep, _AX) // MOVQ ss.Ep, AX
self.Emit("LEAQ", jit.Sib(_IP, _AX, 1, 0), _SI) // LEAQ (IP)(AX), SI
self.Emit("MOVQ", _IC, _CX) // MOVQ IC, CX
self.Emit("SUBQ", _AX, _CX) // SUBQ AX, CX
self.Emit("MOVQ", _SI, _AX) // MOVQ SI, AX
self.Emit("MOVQ", _CX, _BX) // MOVQ CX, BX
self.call_go(_F_convTstring) // CALL_GO runtime.convTstring
self.Emit("MOVQ", _T_number, _R8) // MOVQ _T_number, R8
self.Emit("MOVQ", _AX, _R9) // MOVQ AX, R9
self.Emit("MOVQ", _VAR_ss_Ep, _DI) // MOVQ ss.Ep, DI
self.Sjmp("JMP" , "_set_value") // JMP _set_value
/* represent numbers as `int64` */
self.Link("_use_int64") // _use_int64:
self.Emit("MOVQ", _VAR_ss_Iv, _AX) // MOVQ ss.Iv, AX
self.call_go(_F_convT64) // CALL_GO runtime.convT64
self.Emit("MOVQ", _T_int64, _R8) // MOVQ _T_int64, R8
self.Emit("MOVQ", _AX, _R9) // MOVQ AX, R9
self.Emit("MOVQ", _VAR_ss_Ep, _DI) // MOVQ ss.Ep, DI
self.Sjmp("JMP" , "_set_value") // JMP _set_value
/** V_KEY_SEP **/
self.Link("_decode_V_KEY_SEP") // _decode_V_KEY_SEP:
self.Emit("MOVQ", jit.Ptr(_ST, _ST_Sp), _CX) // MOVQ ST.Sp, CX
self.Emit("MOVQ", jit.Sib(_ST, _CX, 8, _ST_Vt), _AX) // MOVQ ST.Vt[CX], AX
self.Emit("CMPQ", _AX, jit.Imm(_S_obj_delim)) // CMPQ AX, _S_obj_delim
self.Sjmp("JNE" , "_invalid_char") // JNE _invalid_char
self.Emit("MOVQ", jit.Imm(_S_val), jit.Sib(_ST, _CX, 8, _ST_Vt)) // MOVQ _S_val, ST.Vt[CX]
self.Emit("MOVQ", jit.Imm(_S_obj), jit.Sib(_ST, _CX, 8, _ST_Vt - 8)) // MOVQ _S_obj, ST.Vt[CX - 1]
self.Sjmp("JMP" , "_next") // JMP _next
/** V_ELEM_SEP **/
self.Link("_decode_V_ELEM_SEP") // _decode_V_ELEM_SEP:
self.Emit("MOVQ" , jit.Ptr(_ST, _ST_Sp), _CX) // MOVQ ST.Sp, CX
self.Emit("MOVQ" , jit.Sib(_ST, _CX, 8, _ST_Vt), _AX) // MOVQ ST.Vt[CX], AX
self.Emit("CMPQ" , _AX, jit.Imm(_S_arr))
self.Sjmp("JE" , "_array_sep") // JZ _next
self.Emit("CMPQ" , _AX, jit.Imm(_S_obj)) // CMPQ _AX, _S_arr
self.Sjmp("JNE" , "_invalid_char") // JNE _invalid_char
self.Emit("MOVQ" , jit.Imm(_S_obj_sep), jit.Sib(_ST, _CX, 8, _ST_Vt))
self.Sjmp("JMP" , "_next") // JMP _next
/* arrays */
self.Link("_array_sep")
self.Emit("MOVQ", jit.Sib(_ST, _CX, 8, _ST_Vp), _SI) // MOVQ ST.Vp[CX], SI
self.Emit("MOVQ", jit.Ptr(_SI, 8), _SI) // MOVQ 8(SI), SI
self.Emit("MOVQ", jit.Ptr(_SI, 8), _DX) // MOVQ 8(SI), DX
self.Emit("CMPQ", _DX, jit.Ptr(_SI, 16)) // CMPQ DX, 16(SI)
self.Sjmp("JAE" , "_array_more") // JAE _array_more
/* add a slot for the new element */
self.Link("_array_append") // _array_append:
self.Emit("ADDQ", jit.Imm(1), jit.Ptr(_SI, 8)) // ADDQ $1, 8(SI)
self.Emit("MOVQ", jit.Ptr(_SI, 0), _SI) // MOVQ (SI), SI
self.Emit("ADDQ", jit.Imm(1), _CX) // ADDQ $1, CX
self.Emit("CMPQ", _CX, jit.Imm(types.MAX_RECURSE)) // CMPQ CX, ${types.MAX_RECURSE}
self.Sjmp("JAE" , "_stack_overflow") // JA _stack_overflow
self.Emit("SHLQ", jit.Imm(1), _DX) // SHLQ $1, DX
self.Emit("LEAQ", jit.Sib(_SI, _DX, 8, 0), _SI) // LEAQ (SI)(DX*8), SI
self.Emit("MOVQ", _CX, jit.Ptr(_ST, _ST_Sp)) // MOVQ CX, ST.Sp
self.WriteRecNotAX(7 , _SI, jit.Sib(_ST, _CX, 8, _ST_Vp), false) // MOVQ SI, ST.Vp[CX]
self.Emit("MOVQ", jit.Imm(_S_val), jit.Sib(_ST, _CX, 8, _ST_Vt)) // MOVQ _S_val, ST.Vt[CX}
self.Sjmp("JMP" , "_next") // JMP _next
/** V_ARRAY_END **/
self.Link("_decode_V_ARRAY_END") // _decode_V_ARRAY_END:
self.Emit("XORL", _DX, _DX) // XORL DX, DX
self.Emit("MOVQ", jit.Ptr(_ST, _ST_Sp), _CX) // MOVQ ST.Sp, CX
self.Emit("MOVQ", jit.Sib(_ST, _CX, 8, _ST_Vt), _AX) // MOVQ ST.Vt[CX], AX
self.Emit("CMPQ", _AX, jit.Imm(_S_arr_0)) // CMPQ AX, _S_arr_0
self.Sjmp("JE" , "_first_item") // JE _first_item
self.Emit("CMPQ", _AX, jit.Imm(_S_arr)) // CMPQ AX, _S_arr
self.Sjmp("JNE" , "_invalid_char") // JNE _invalid_char
self.Emit("SUBQ", jit.Imm(1), jit.Ptr(_ST, _ST_Sp)) // SUBQ $1, ST.Sp
self.Emit("MOVQ", _DX, jit.Sib(_ST, _CX, 8, _ST_Vp)) // MOVQ DX, ST.Vp[CX]
self.Sjmp("JMP" , "_next") // JMP _next
/* first element of an array */
self.Link("_first_item") // _first_item:
self.Emit("MOVQ", jit.Ptr(_ST, _ST_Sp), _CX) // MOVQ ST.Sp, CX
self.Emit("SUBQ", jit.Imm(2), jit.Ptr(_ST, _ST_Sp)) // SUBQ $2, ST.Sp
self.Emit("MOVQ", jit.Sib(_ST, _CX, 8, _ST_Vp - 8), _SI) // MOVQ ST.Vp[CX - 1], SI
self.Emit("MOVQ", jit.Ptr(_SI, 8), _SI) // MOVQ 8(SI), SI
self.Emit("MOVQ", _DX, jit.Sib(_ST, _CX, 8, _ST_Vp - 8)) // MOVQ DX, ST.Vp[CX - 1]
self.Emit("MOVQ", _DX, jit.Sib(_ST, _CX, 8, _ST_Vp)) // MOVQ DX, ST.Vp[CX]
self.Emit("MOVQ", _DX, jit.Ptr(_SI, 8)) // MOVQ DX, 8(SI)
self.Sjmp("JMP" , "_next") // JMP _next
/** V_OBJECT_END **/
self.Link("_decode_V_OBJECT_END") // _decode_V_OBJECT_END:
self.Emit("MOVL", jit.Imm(_S_omask_end), _DI) // MOVL _S_omask, DI
self.Emit("MOVQ", jit.Ptr(_ST, _ST_Sp), _CX) // MOVQ ST.Sp, CX
self.Emit("MOVQ", jit.Sib(_ST, _CX, 8, _ST_Vt), _AX) // MOVQ ST.Vt[CX], AX
self.Emit("BTQ" , _AX, _DI)
self.Sjmp("JNC" , "_invalid_char") // JNE _invalid_char
self.Emit("XORL", _AX, _AX) // XORL AX, AX
self.Emit("SUBQ", jit.Imm(1), jit.Ptr(_ST, _ST_Sp)) // SUBQ $1, ST.Sp
self.Emit("MOVQ", _AX, jit.Sib(_ST, _CX, 8, _ST_Vp)) // MOVQ AX, ST.Vp[CX]
self.Sjmp("JMP" , "_next") // JMP _next
/* return from decoder */
self.Link("_return") // _return:
self.Emit("XORL", _EP, _EP) // XORL EP, EP
self.Emit("MOVQ", _EP, jit.Ptr(_ST, _ST_Vp)) // MOVQ EP, ST.Vp[0]
self.Link("_epilogue") // _epilogue:
self.Emit("SUBQ", jit.Imm(_FsmOffset), _ST) // SUBQ _FsmOffset, _ST
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") // RET
/* array expand */
self.Link("_array_more") // _array_more:
self.Emit("MOVQ" , _T_eface, _AX) // MOVQ _T_eface, AX
self.Emit("MOVQ" , jit.Ptr(_SI, 0), _BX) // MOVQ (SI), BX
self.Emit("MOVQ" , jit.Ptr(_SI, 8), _CX) // MOVQ 8(SI), CX
self.Emit("MOVQ" , jit.Ptr(_SI, 16), _DI) // MOVQ 16(SI), DI
self.Emit("MOVQ" , _DI, _SI) // MOVQ DI, 24(SP)
self.Emit("SHLQ" , jit.Imm(1), _SI) // SHLQ $1, SI
self.call_go(_F_growslice) // CALL_GO runtime.growslice
self.Emit("MOVQ" , _AX, _DI) // MOVQ AX, DI
self.Emit("MOVQ" , _BX, _DX) // MOVQ BX, DX
self.Emit("MOVQ" , _CX, _AX) // MOVQ CX, AX
/* update the slice */
self.Emit("MOVQ", jit.Ptr(_ST, _ST_Sp), _CX) // MOVQ ST.Sp, CX
self.Emit("MOVQ", jit.Sib(_ST, _CX, 8, _ST_Vp), _SI) // MOVQ ST.Vp[CX], SI
self.Emit("MOVQ", jit.Ptr(_SI, 8), _SI) // MOVQ 8(SI), SI
self.Emit("MOVQ", _DX, jit.Ptr(_SI, 8)) // MOVQ DX, 8(SI)
self.Emit("MOVQ", _AX, jit.Ptr(_SI, 16)) // MOVQ AX, 16(AX)
self.WriteRecNotAX(8 , _DI, jit.Ptr(_SI, 0), false) // MOVQ R10, (SI)
self.Sjmp("JMP" , "_array_append") // JMP _array_append
/* copy string */
self.Link("copy_string") // pointer: R8, length: AX, return addr: DI
self.Emit("MOVQ", _R8, _VAR_cs_p)
self.Emit("MOVQ", _AX, _VAR_cs_n)
self.Emit("MOVQ", _DI, _VAR_cs_LR)
self.Emit("MOVQ", _AX, _BX)
self.Emit("MOVQ", _AX, _CX)
self.Emit("MOVQ", _T_byte, _AX)
self.call_go(_F_makeslice)
self.Emit("MOVQ", _AX, _VAR_cs_d)
self.Emit("MOVQ", _VAR_cs_p, _BX)
self.Emit("MOVQ", _VAR_cs_n, _CX)
self.call_go(_F_memmove)
self.Emit("MOVQ", _VAR_cs_d, _R8)
self.Emit("MOVQ", _VAR_cs_n, _AX)
self.Emit("MOVQ", _VAR_cs_LR, _DI)
self.Rjmp("JMP", _DI)
/* error handlers */
self.Link("_stack_overflow")
self.Emit("MOVL" , _E_recurse, _EP) // MOVQ _E_recurse, EP
self.Sjmp("JMP" , "_error") // JMP _error
self.Link("_vtype_error") // _vtype_error:
self.Emit("MOVQ" , _DI, _IC) // MOVQ DI, IC
self.Emit("MOVL" , _E_invalid, _EP) // MOVL _E_invalid, EP
self.Sjmp("JMP" , "_error") // JMP _error
self.Link("_invalid_char") // _invalid_char:
self.Emit("SUBQ" , jit.Imm(1), _IC) // SUBQ $1, IC
self.Emit("MOVL" , _E_invalid, _EP) // MOVL _E_invalid, EP
self.Sjmp("JMP" , "_error") // JMP _error
self.Link("_unquote_error") // _unquote_error:
self.Emit("MOVQ" , _VAR_ss_Iv, _IC) // MOVQ ss.Iv, IC
self.Emit("SUBQ" , jit.Imm(1), _IC) // SUBQ $1, IC
self.Link("_parsing_error") // _parsing_error:
self.Emit("NEGQ" , _AX) // NEGQ AX
self.Emit("MOVQ" , _AX, _EP) // MOVQ AX, EP
self.Link("_error") // _error:
self.Emit("PXOR" , _X0, _X0) // PXOR X0, X0
self.Emit("MOVOU", _X0, jit.Ptr(_VP, 0)) // MOVOU X0, (VP)
self.Sjmp("JMP" , "_epilogue") // JMP _epilogue
/* invalid value type, never returns */
self.Link("_invalid_vtype")
self.call_go(_F_invalid_vtype) // CALL invalid_type
self.Emit("UD2") // UD2
/* switch jump table */
self.Link("_switch_table") // _switch_table:
self.Sref("_decode_V_EOF", 0) // SREF &_decode_V_EOF, $0
self.Sref("_decode_V_NULL", -4) // SREF &_decode_V_NULL, $-4
self.Sref("_decode_V_TRUE", -8) // SREF &_decode_V_TRUE, $-8
self.Sref("_decode_V_FALSE", -12) // SREF &_decode_V_FALSE, $-12
self.Sref("_decode_V_ARRAY", -16) // SREF &_decode_V_ARRAY, $-16
self.Sref("_decode_V_OBJECT", -20) // SREF &_decode_V_OBJECT, $-20
self.Sref("_decode_V_STRING", -24) // SREF &_decode_V_STRING, $-24
self.Sref("_decode_V_DOUBLE", -28) // SREF &_decode_V_DOUBLE, $-28
self.Sref("_decode_V_INTEGER", -32) // SREF &_decode_V_INTEGER, $-32
self.Sref("_decode_V_KEY_SEP", -36) // SREF &_decode_V_KEY_SEP, $-36
self.Sref("_decode_V_ELEM_SEP", -40) // SREF &_decode_V_ELEM_SEP, $-40
self.Sref("_decode_V_ARRAY_END", -44) // SREF &_decode_V_ARRAY_END, $-44
self.Sref("_decode_V_OBJECT_END", -48) // SREF &_decode_V_OBJECT_END, $-48
/* fast character lookup table */
self.Link("_decode_tab") // _decode_tab:
self.Sref("_decode_V_EOF", 0) // SREF &_decode_V_EOF, $0
/* generate rest of the tabs */
for i := 1; i < 256; i++ {
if to, ok := _R_tab[i]; ok {
self.Sref(to, -int64(i) * 4)
} else {
self.Byte(0x00, 0x00, 0x00, 0x00)
}
}
}
/** Generic Decoder **/
var (
_subr_decode_value = new(_ValueDecoder).build()
)
//go:nosplit
func invalid_vtype(vt types.ValueType) {
rt.Throw(fmt.Sprintf("invalid value type: %d", vt))
}

View File

@@ -0,0 +1,37 @@
// +build go1.17
//
// 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 ·decodeValueStub(SB), NOSPLIT, $0 - 72
NO_LOCAL_POINTERS
PXOR X0, X0
MOVOU X0, rv+48(FP)
MOVQ st+0(FP) , R13
MOVQ sp+8(FP) , R10
MOVQ sn+16(FP), R12
MOVQ ic+24(FP), R11
MOVQ vp+32(FP), R15
MOVQ df+40(FP), AX
MOVQ ·_subr_decode_value(SB), BX
CALL BX
MOVQ R11, rp+48(FP)
MOVQ BX, ex+56(FP)
RET

View File

@@ -0,0 +1,145 @@
/*
* 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 jitdec
import (
`sync`
`unsafe`
`github.com/bytedance/sonic/internal/caching`
`github.com/bytedance/sonic/internal/native/types`
`github.com/bytedance/sonic/internal/rt`
)
const (
_MinSlice = 2
_MaxStack = 4096 // 4k slots
_MaxStackBytes = _MaxStack * _PtrBytes
_MaxDigitNums = types.MaxDigitNums // used in atof fallback algorithm
)
const (
_PtrBytes = _PTR_SIZE / 8
_FsmOffset = (_MaxStack + 1) * _PtrBytes
_DbufOffset = _FsmOffset + int64(unsafe.Sizeof(types.StateMachine{})) + types.MAX_RECURSE * _PtrBytes
_EpOffset = _DbufOffset + _MaxDigitNums
_StackSize = unsafe.Sizeof(_Stack{})
)
var (
stackPool = sync.Pool{}
valueCache = []unsafe.Pointer(nil)
fieldCache = []*caching.FieldMap(nil)
fieldCacheMux = sync.Mutex{}
programCache = caching.CreateProgramCache()
)
type _Stack struct {
sp uintptr
sb [_MaxStack]unsafe.Pointer
mm types.StateMachine
vp [types.MAX_RECURSE]unsafe.Pointer
dp [_MaxDigitNums]byte
ep unsafe.Pointer
}
type _Decoder func(
s string,
i int,
vp unsafe.Pointer,
sb *_Stack,
fv uint64,
sv string, // DO NOT pass value to this argument, since it is only used for local _VAR_sv
vk unsafe.Pointer, // DO NOT pass value to this argument, since it is only used for local _VAR_vk
) (int, error)
var _KeepAlive struct {
s string
i int
vp unsafe.Pointer
sb *_Stack
fv uint64
sv string
vk unsafe.Pointer
ret int
err error
frame_decoder [_FP_offs]byte
frame_generic [_VD_offs]byte
}
var (
argPtrs = []bool{true, false, false, true, true, false, true, false, true}
localPtrs = []bool{}
)
var (
argPtrs_generic = []bool{true}
localPtrs_generic = []bool{}
)
func newStack() *_Stack {
if ret := stackPool.Get(); ret == nil {
return new(_Stack)
} else {
return ret.(*_Stack)
}
}
func resetStack(p *_Stack) {
rt.MemclrNoHeapPointers(unsafe.Pointer(p), _StackSize)
}
func freeStack(p *_Stack) {
p.sp = 0
stackPool.Put(p)
}
func freezeValue(v unsafe.Pointer) uintptr {
valueCache = append(valueCache, v)
return uintptr(v)
}
func freezeFields(v *caching.FieldMap) int64 {
fieldCacheMux.Lock()
fieldCache = append(fieldCache, v)
fieldCacheMux.Unlock()
return referenceFields(v)
}
func referenceFields(v *caching.FieldMap) int64 {
return int64(uintptr(unsafe.Pointer(v)))
}
func makeDecoder(vt *rt.GoType, _ ...interface{}) (interface{}, error) {
if pp, err := newCompiler().compile(vt.Pack()); err != nil {
return nil, err
} else {
return newAssembler(pp).Load(), nil
}
}
func findOrCompile(vt *rt.GoType) (_Decoder, error) {
if val := programCache.Get(vt); val != nil {
return val.(_Decoder), nil
} else if ret, err := programCache.Compute(vt, makeDecoder); err == nil {
return ret.(_Decoder), nil
} else {
return nil, err
}
}

View File

@@ -0,0 +1,58 @@
/*
* 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 jitdec
import (
`encoding`
`encoding/json`
`unsafe`
`github.com/bytedance/sonic/internal/native`
`github.com/bytedance/sonic/internal/rt`
)
func decodeTypedPointer(s string, i int, vt *rt.GoType, vp unsafe.Pointer, sb *_Stack, fv uint64) (int, error) {
if fn, err := findOrCompile(vt); err != nil {
return 0, err
} else {
rt.MoreStack(_FP_size + _VD_size + native.MaxFrameSize)
ret, err := fn(s, i, vp, sb, fv, "", nil)
return ret, err
}
}
func decodeJsonUnmarshaler(vv interface{}, s string) error {
return vv.(json.Unmarshaler).UnmarshalJSON(rt.Str2Mem(s))
}
// used to distinguish between MismatchQuoted and other MismatchedTyped errors, see issue #670 and #716
type MismatchQuotedError struct {}
func (*MismatchQuotedError) Error() string {
return "mismatch quoted"
}
func decodeJsonUnmarshalerQuoted(vv interface{}, s string) error {
if len(s) < 2 || s[0] != '"' || s[len(s)-1] != '"' {
return &MismatchQuotedError{}
}
return vv.(json.Unmarshaler).UnmarshalJSON(rt.Str2Mem(s[1:len(s)-1]))
}
func decodeTextUnmarshaler(vv interface{}, s string) error {
return vv.(encoding.TextUnmarshaler).UnmarshalText(rt.Str2Mem(s))
}

View File

@@ -0,0 +1,58 @@
/*
* 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 jitdec
import (
`encoding`
`encoding/base64`
`encoding/json`
`reflect`
`unsafe`
`github.com/bytedance/sonic/internal/rt`
)
var (
byteType = reflect.TypeOf(byte(0))
intType = reflect.TypeOf(int(0))
int8Type = reflect.TypeOf(int8(0))
int16Type = reflect.TypeOf(int16(0))
int32Type = reflect.TypeOf(int32(0))
int64Type = reflect.TypeOf(int64(0))
uintType = reflect.TypeOf(uint(0))
uint8Type = reflect.TypeOf(uint8(0))
uint16Type = reflect.TypeOf(uint16(0))
uint32Type = reflect.TypeOf(uint32(0))
uint64Type = reflect.TypeOf(uint64(0))
float32Type = reflect.TypeOf(float32(0))
float64Type = reflect.TypeOf(float64(0))
stringType = reflect.TypeOf("")
bytesType = reflect.TypeOf([]byte(nil))
jsonNumberType = reflect.TypeOf(json.Number(""))
base64CorruptInputError = reflect.TypeOf(base64.CorruptInputError(0))
)
var (
errorType = reflect.TypeOf((*error)(nil)).Elem()
jsonUnmarshalerType = reflect.TypeOf((*json.Unmarshaler)(nil)).Elem()
encodingTextUnmarshalerType = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem()
)
func rtype(t reflect.Type) (*rt.GoItab, *rt.GoType) {
p := (*rt.GoIface)(unsafe.Pointer(&t))
return p.Itab, (*rt.GoType)(p.Value)
}

View File

@@ -0,0 +1,39 @@
/*
* 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 jitdec
import (
`unsafe`
`github.com/bytedance/sonic/loader`
)
//go:nosplit
func pbool(v bool) uintptr {
return freezeValue(unsafe.Pointer(&v))
}
//go:nosplit
func ptodec(p loader.Function) _Decoder {
return *(*_Decoder)(unsafe.Pointer(&p))
}
func assert_eq(v int64, exp int64, msg string) {
if v != exp {
panic(msg)
}
}

View File

@@ -0,0 +1,174 @@
package optdec
import (
"fmt"
"reflect"
caching "github.com/bytedance/sonic/internal/optcaching"
"github.com/bytedance/sonic/internal/rt"
"github.com/bytedance/sonic/internal/resolver"
)
const (
_MAX_FIELDS = 50 // cutoff at 50 fields struct
)
func (c *compiler) compileIntStringOption(vt reflect.Type) decFunc {
switch vt.Size() {
case 4:
switch vt.Kind() {
case reflect.Uint:
fallthrough
case reflect.Uintptr:
return &u32StringDecoder{}
case reflect.Int:
return &i32StringDecoder{}
}
case 8:
switch vt.Kind() {
case reflect.Uint:
fallthrough
case reflect.Uintptr:
return &u64StringDecoder{}
case reflect.Int:
return &i64StringDecoder{}
}
default:
panic("not supported pointer size: " + fmt.Sprint(vt.Size()))
}
panic("unreachable")
}
func isInteger(vt reflect.Type) bool {
switch vt.Kind() {
case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint, reflect.Uintptr, reflect.Int: return true
default: return false
}
}
func (c *compiler) assertStringOptTypes(vt reflect.Type) {
if c.depth > _CompileMaxDepth {
panic(*stackOverflow)
}
c.depth += 1
defer func () {
c.depth -= 1
}()
if isInteger(vt) {
return
}
switch vt.Kind() {
case reflect.String, reflect.Bool, reflect.Float32, reflect.Float64:
return
case reflect.Ptr: c.assertStringOptTypes(vt.Elem())
default:
panicForInvalidStrType(vt)
}
}
func (c *compiler) compileFieldStringOption(vt reflect.Type) decFunc {
c.assertStringOptTypes(vt)
unmDec := c.tryCompilePtrUnmarshaler(vt, true)
if unmDec != nil {
return unmDec
}
switch vt.Kind() {
case reflect.String:
if vt == jsonNumberType {
return &numberStringDecoder{}
}
return &strStringDecoder{}
case reflect.Bool:
return &boolStringDecoder{}
case reflect.Int8:
return &i8StringDecoder{}
case reflect.Int16:
return &i16StringDecoder{}
case reflect.Int32:
return &i32StringDecoder{}
case reflect.Int64:
return &i64StringDecoder{}
case reflect.Uint8:
return &u8StringDecoder{}
case reflect.Uint16:
return &u16StringDecoder{}
case reflect.Uint32:
return &u32StringDecoder{}
case reflect.Uint64:
return &u64StringDecoder{}
case reflect.Float32:
return &f32StringDecoder{}
case reflect.Float64:
return &f64StringDecoder{}
case reflect.Uint:
fallthrough
case reflect.Uintptr:
fallthrough
case reflect.Int:
return c.compileIntStringOption(vt)
case reflect.Ptr:
return &ptrStrDecoder{
typ: rt.UnpackType(vt.Elem()),
deref: c.compileFieldStringOption(vt.Elem()),
}
default:
panicForInvalidStrType(vt)
return nil
}
}
func (c *compiler) compileStruct(vt reflect.Type) decFunc {
c.enter(vt)
defer c.exit(vt)
if c.namedPtr {
c.namedPtr = false
return c.compileStructBody(vt)
}
if c.depth >= c.opts.MaxInlineDepth + 1 || (c.counts > 0 && vt.NumField() >= _MAX_FIELDS) {
return &recuriveDecoder{
typ: rt.UnpackType(vt),
}
} else {
return c.compileStructBody(vt)
}
}
func (c *compiler) compileStructBody(vt reflect.Type) decFunc {
fv := resolver.ResolveStruct(vt)
entries := make([]fieldEntry, 0, len(fv))
for _, f := range fv {
var dec decFunc
/* dealt with field tag options */
if f.Opts&resolver.F_stringize != 0 {
dec = c.compileFieldStringOption(f.Type)
} else {
dec = c.compile(f.Type)
}
/* deal with embedded pointer fields */
if f.Path[0].Kind == resolver.F_deref {
dec = &embeddedFieldPtrDecoder{
field: f,
fieldDec: dec,
fieldName: f.Name,
}
}
entries = append(entries, fieldEntry{
FieldMeta: f,
fieldDec: dec,
})
}
return &structDecoder{
fieldMap: caching.NewFieldLookup(fv),
fields: entries,
structName: vt.Name(),
typ: vt,
}
}

View File

@@ -0,0 +1,460 @@
package optdec
import (
"fmt"
"reflect"
"github.com/bytedance/sonic/option"
"github.com/bytedance/sonic/internal/rt"
"github.com/bytedance/sonic/internal/caching"
)
var (
programCache = caching.CreateProgramCache()
)
func findOrCompile(vt *rt.GoType) (decFunc, error) {
makeDecoder := func(vt *rt.GoType, _ ...interface{}) (interface{}, error) {
ret, err := newCompiler().compileType(vt.Pack())
return ret, err
}
if val := programCache.Get(vt); val != nil {
return val.(decFunc), nil
} else if ret, err := programCache.Compute(vt, makeDecoder); err == nil {
return ret.(decFunc), nil
} else {
return nil, err
}
}
type compiler struct {
visited map[reflect.Type]bool
depth int
counts int
opts option.CompileOptions
namedPtr bool
}
func newCompiler() *compiler {
return &compiler{
visited: make(map[reflect.Type]bool),
opts: option.DefaultCompileOptions(),
}
}
func (self *compiler) apply(opts option.CompileOptions) *compiler {
self.opts = opts
return self
}
const _CompileMaxDepth = 4096
func (c *compiler) enter(vt reflect.Type) {
c.visited[vt] = true
c.depth += 1
if c.depth > _CompileMaxDepth {
panic(*stackOverflow)
}
}
func (c *compiler) exit(vt reflect.Type) {
c.visited[vt] = false
c.depth -= 1
}
func (c *compiler) compileInt(vt reflect.Type) decFunc {
switch vt.Size() {
case 4:
switch vt.Kind() {
case reflect.Uint:
fallthrough
case reflect.Uintptr:
return &u32Decoder{}
case reflect.Int:
return &i32Decoder{}
}
case 8:
switch vt.Kind() {
case reflect.Uint:
fallthrough
case reflect.Uintptr:
return &u64Decoder{}
case reflect.Int:
return &i64Decoder{}
}
default:
panic("not supported pointer size: " + fmt.Sprint(vt.Size()))
}
panic("unreachable")
}
func (c *compiler) rescue(ep *error) {
if val := recover(); val != nil {
if err, ok := val.(error); ok {
*ep = err
} else {
panic(val)
}
}
}
func (c *compiler) compileType(vt reflect.Type) (rt decFunc, err error) {
defer c.rescue(&err)
rt = c.compile(vt)
return rt, err
}
func (c *compiler) compile(vt reflect.Type) decFunc {
if c.visited[vt] {
return &recuriveDecoder{
typ: rt.UnpackType(vt),
}
}
dec := c.tryCompilePtrUnmarshaler(vt, false)
if dec != nil {
return dec
}
return c.compileBasic(vt)
}
func (c *compiler) compileBasic(vt reflect.Type) decFunc {
defer func() {
c.counts += 1
}()
switch vt.Kind() {
case reflect.Bool:
return &boolDecoder{}
case reflect.Int8:
return &i8Decoder{}
case reflect.Int16:
return &i16Decoder{}
case reflect.Int32:
return &i32Decoder{}
case reflect.Int64:
return &i64Decoder{}
case reflect.Uint8:
return &u8Decoder{}
case reflect.Uint16:
return &u16Decoder{}
case reflect.Uint32:
return &u32Decoder{}
case reflect.Uint64:
return &u64Decoder{}
case reflect.Float32:
return &f32Decoder{}
case reflect.Float64:
return &f64Decoder{}
case reflect.Uint:
fallthrough
case reflect.Uintptr:
fallthrough
case reflect.Int:
return c.compileInt(vt)
case reflect.String:
return c.compileString(vt)
case reflect.Array:
return c.compileArray(vt)
case reflect.Interface:
return c.compileInterface(vt)
case reflect.Map:
return c.compileMap(vt)
case reflect.Ptr:
return c.compilePtr(vt)
case reflect.Slice:
return c.compileSlice(vt)
case reflect.Struct:
return c.compileStruct(vt)
default:
return &unsupportedTypeDecoder{
typ: rt.UnpackType(vt),
}
}
}
func (c *compiler) compilePtr(vt reflect.Type) decFunc {
c.enter(vt)
defer c.exit(vt)
// special logic for Named Ptr, issue 379
if reflect.PtrTo(vt.Elem()) != vt {
c.namedPtr = true
return &ptrDecoder{
typ: rt.UnpackType(vt.Elem()),
deref: c.compileBasic(vt.Elem()),
}
}
return &ptrDecoder{
typ: rt.UnpackType(vt.Elem()),
deref: c.compile(vt.Elem()),
}
}
func (c *compiler) compileArray(vt reflect.Type) decFunc {
c.enter(vt)
defer c.exit(vt)
return &arrayDecoder{
len: vt.Len(),
elemType: rt.UnpackType(vt.Elem()),
elemDec: c.compile(vt.Elem()),
typ: vt,
}
}
func (c *compiler) compileString(vt reflect.Type) decFunc {
if vt == jsonNumberType {
return &numberDecoder{}
}
return &stringDecoder{}
}
func (c *compiler) tryCompileSliceUnmarshaler(vt reflect.Type) decFunc {
pt := reflect.PtrTo(vt.Elem())
if pt.Implements(jsonUnmarshalerType) {
return &sliceDecoder{
elemType: rt.UnpackType(vt.Elem()),
elemDec: c.compile(vt.Elem()),
typ: vt,
}
}
if pt.Implements(encodingTextUnmarshalerType) {
return &sliceDecoder{
elemType: rt.UnpackType(vt.Elem()),
elemDec: c.compile(vt.Elem()),
typ: vt,
}
}
return nil
}
func (c *compiler) compileSlice(vt reflect.Type) decFunc {
c.enter(vt)
defer c.exit(vt)
// Some common slice, use a decoder, to avoid function calls
et := rt.UnpackType(vt.Elem())
/* first checking `[]byte` */
if et.Kind() == reflect.Uint8 /* []byte */ {
return c.compileSliceBytes(vt)
}
dec := c.tryCompileSliceUnmarshaler(vt)
if dec != nil {
return dec
}
if vt == reflect.TypeOf([]interface{}{}) {
return &sliceEfaceDecoder{}
}
if et.IsInt32() {
return &sliceI32Decoder{}
}
if et.IsInt64() {
return &sliceI64Decoder{}
}
if et.IsUint32() {
return &sliceU32Decoder{}
}
if et.IsUint64() {
return &sliceU64Decoder{}
}
if et.Kind() == reflect.String && et != rt.JsonNumberType {
return &sliceStringDecoder{}
}
return &sliceDecoder{
elemType: rt.UnpackType(vt.Elem()),
elemDec: c.compile(vt.Elem()),
typ: vt,
}
}
func (c *compiler) compileSliceBytes(vt reflect.Type) decFunc {
ep := reflect.PtrTo(vt.Elem())
if ep.Implements(jsonUnmarshalerType) {
return &sliceBytesUnmarshalerDecoder{
elemType: rt.UnpackType(vt.Elem()),
elemDec: c.compile(vt.Elem()),
typ: vt,
}
}
if ep.Implements(encodingTextUnmarshalerType) {
return &sliceBytesUnmarshalerDecoder{
elemType: rt.UnpackType(vt.Elem()),
elemDec: c.compile(vt.Elem()),
typ: vt,
}
}
return &sliceBytesDecoder{}
}
func (c *compiler) compileInterface(vt reflect.Type) decFunc {
c.enter(vt)
defer c.exit(vt)
if vt.NumMethod() == 0 {
return &efaceDecoder{}
}
if vt.Implements(jsonUnmarshalerType) {
return &unmarshalJSONDecoder{
typ: rt.UnpackType(vt),
}
}
if vt.Implements(encodingTextUnmarshalerType) {
return &unmarshalTextDecoder{
typ: rt.UnpackType(vt),
}
}
return &ifaceDecoder{
typ: rt.UnpackType(vt),
}
}
func (c *compiler) compileMap(vt reflect.Type) decFunc {
c.enter(vt)
defer c.exit(vt)
// check the key unmarshaler at first
decKey := tryCompileKeyUnmarshaler(vt)
if decKey != nil {
return &mapDecoder{
mapType: rt.MapType(rt.UnpackType(vt)),
keyDec: decKey,
elemDec: c.compile(vt.Elem()),
}
}
// Most common map, use a decoder, to avoid function calls
if vt == reflect.TypeOf(map[string]interface{}{}) {
return &mapEfaceDecoder{}
} else if vt == reflect.TypeOf(map[string]string{}) {
return &mapStringDecoder{}
}
// Some common integer map later
mt := rt.MapType(rt.UnpackType(vt))
if mt.Key.Kind() == reflect.String && mt.Key != rt.JsonNumberType {
return &mapStrKeyDecoder{
mapType: mt,
assign: rt.GetMapStrAssign(vt),
elemDec: c.compile(vt.Elem()),
}
}
if mt.Key.IsInt64() {
return &mapI64KeyDecoder{
mapType: mt,
elemDec: c.compile(vt.Elem()),
assign: rt.GetMap64Assign(vt),
}
}
if mt.Key.IsInt32() {
return &mapI32KeyDecoder{
mapType: mt,
elemDec: c.compile(vt.Elem()),
assign: rt.GetMap32Assign(vt),
}
}
if mt.Key.IsUint64() {
return &mapU64KeyDecoder{
mapType: mt,
elemDec: c.compile(vt.Elem()),
assign: rt.GetMap64Assign(vt),
}
}
if mt.Key.IsUint32() {
return &mapU32KeyDecoder{
mapType: mt,
elemDec: c.compile(vt.Elem()),
assign: rt.GetMap32Assign(vt),
}
}
// Generic map
return &mapDecoder{
mapType: mt,
keyDec: c.compileMapKey(vt),
elemDec: c.compile(vt.Elem()),
}
}
func tryCompileKeyUnmarshaler(vt reflect.Type) decKey {
pt := reflect.PtrTo(vt.Key())
/* check for `encoding.TextUnmarshaler` with pointer receiver */
if pt.Implements(encodingTextUnmarshalerType) {
return decodeKeyTextUnmarshaler
}
/* NOTE: encoding/json not support map key with `json.Unmarshaler` */
return nil
}
func (c *compiler) compileMapKey(vt reflect.Type) decKey {
switch vt.Key().Kind() {
case reflect.Int8:
return decodeKeyI8
case reflect.Int16:
return decodeKeyI16
case reflect.Uint8:
return decodeKeyU8
case reflect.Uint16:
return decodeKeyU16
// NOTE: actually, encoding/json can't use float as map key
case reflect.Float32:
return decodeFloat32Key
case reflect.Float64:
return decodeFloat64Key
case reflect.String:
if rt.UnpackType(vt.Key()) == rt.JsonNumberType {
return decodeJsonNumberKey
}
fallthrough
default:
return nil
}
}
// maybe vt is a named type, and not a pointer receiver, see issue 379
func (c *compiler) tryCompilePtrUnmarshaler(vt reflect.Type, strOpt bool) decFunc {
pt := reflect.PtrTo(vt)
/* check for `json.Unmarshaler` with pointer receiver */
if pt.Implements(jsonUnmarshalerType) {
return &unmarshalJSONDecoder{
typ: rt.UnpackType(pt),
strOpt: strOpt,
}
}
/* check for `encoding.TextMarshaler` with pointer receiver */
if pt.Implements(encodingTextUnmarshalerType) {
/* TextUnmarshal not support, string tag */
if strOpt {
panicForInvalidStrType(vt)
}
return &unmarshalTextDecoder{
typ: rt.UnpackType(pt),
}
}
return nil
}
func panicForInvalidStrType(vt reflect.Type) {
panic(error_type(rt.UnpackType(vt)))
}

View File

@@ -0,0 +1,60 @@
package optdec
import "math"
/*
Copied from sonic-rs
// JSON Value Type
const NULL: u64 = 0;
const BOOL: u64 = 2;
const FALSE: u64 = BOOL;
const TRUE: u64 = (1 << 3) | BOOL;
const NUMBER: u64 = 3;
const UINT: u64 = NUMBER;
const SINT: u64 = (1 << 3) | NUMBER;
const REAL: u64 = (2 << 3) | NUMBER;
const RAWNUMBER: u64 = (3 << 3) | NUMBER;
const STRING: u64 = 4;
const STRING_COMMON: u64 = STRING;
const STRING_HASESCAPED: u64 = (1 << 3) | STRING;
const OBJECT: u64 = 6;
const ARRAY: u64 = 7;
/// JSON Type Mask
const POS_MASK: u64 = (!0) << 32;
const POS_BITS: u64 = 32;
const TYPE_MASK: u64 = 0xFF;
const TYPE_BITS: u64 = 8;
*/
const (
// BasicType: 3 bits
KNull = 0 // xxxxx000
KBool = 2 // xxxxx010
KNumber = 3 // xxxxx011
KString = 4 // xxxxx100
KRaw = 5 // xxxxx101
KObject = 6 // xxxxx110
KArray = 7 // xxxxx111
// SubType: 2 bits
KFalse = (0 << 3) | KBool // xxx00_010, 2
KTrue = (1 << 3) | KBool // xxx01_010, 10
KUint = (0 << 3) | KNumber // xxx00_011, 3
KSint = (1 << 3) | KNumber // xxx01_011, 11
KReal = (2 << 3) | KNumber // xxx10_011, 19
KRawNumber = (3 << 3) | KNumber // xxx11_011, 27
KStringCommon = KString // xxx00_100, 4
KStringEscaped = (1 << 3) | KString // xxx01_100, 12
)
const (
PosMask = math.MaxUint64 << 32
PosBits = 32
TypeMask = 0xFF
TypeBits = 8
ConLenMask = uint64(math.MaxUint32)
ConLenBits = 32
)

View File

@@ -0,0 +1,3 @@
package optdec
type context = Context

View File

@@ -0,0 +1,160 @@
package optdec
import (
"reflect"
"unsafe"
"encoding/json"
"github.com/bytedance/sonic/internal/rt"
"github.com/bytedance/sonic/option"
"github.com/bytedance/sonic/internal/decoder/errors"
"github.com/bytedance/sonic/internal/decoder/consts"
)
type (
MismatchTypeError = errors.MismatchTypeError
SyntaxError = errors.SyntaxError
)
const (
_F_allow_control = consts.F_allow_control
_F_copy_string = consts.F_copy_string
_F_disable_unknown = consts.F_disable_unknown
_F_disable_urc = consts.F_disable_urc
_F_use_int64 = consts.F_use_int64
_F_use_number = consts.F_use_number
_F_validate_string = consts.F_validate_string
)
type Options = consts.Options
const (
OptionUseInt64 = consts.OptionUseInt64
OptionUseNumber = consts.OptionUseNumber
OptionUseUnicodeErrors = consts.OptionUseUnicodeErrors
OptionDisableUnknown = consts.OptionDisableUnknown
OptionCopyString = consts.OptionCopyString
OptionValidateString = consts.OptionValidateString
)
func Decode(s *string, i *int, f uint64, val interface{}) error {
vv := rt.UnpackEface(val)
vp := vv.Value
/* check for nil type */
if vv.Type == nil {
return &json.InvalidUnmarshalError{}
}
/* must be a non-nil pointer */
if vp == nil || vv.Type.Kind() != reflect.Ptr {
return &json.InvalidUnmarshalError{Type: vv.Type.Pack()}
}
etp := rt.PtrElem(vv.Type)
/* check the defined pointer type for issue 379 */
if vv.Type.IsNamed() {
newp := vp
etp = vv.Type
vp = unsafe.Pointer(&newp)
}
dec, err := findOrCompile(etp)
if err != nil {
return err
}
/* parse into document */
ctx, err := NewContext(*s, *i, uint64(f), etp)
defer ctx.Delete()
if ctx.Parser.Utf8Inv {
*s = ctx.Parser.Json
}
if err != nil {
goto fix_error;
}
err = dec.FromDom(vp, ctx.Root(), &ctx)
fix_error:
err = fix_error(*s, *i, err)
// update position at last
*i += ctx.Parser.Pos()
return err
}
func fix_error(json string, pos int, err error) error {
if e, ok := err.(SyntaxError); ok {
return SyntaxError{
Pos: int(e.Pos) + pos,
Src: json,
Msg: e.Msg,
}
}
if e, ok := err.(MismatchTypeError); ok {
return &MismatchTypeError {
Pos: int(e.Pos) + pos,
Src: json,
Type: e.Type,
}
}
return err
}
// Pretouch compiles vt ahead-of-time to avoid JIT compilation on-the-fly, in
// order to reduce the first-hit latency.
//
// 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.
func Pretouch(vt reflect.Type, opts ...option.CompileOption) error {
cfg := option.DefaultCompileOptions()
for _, opt := range opts {
opt(&cfg)
}
return pretouchRec(map[reflect.Type]bool{vt:true}, cfg)
}
func pretouchType(_vt reflect.Type, opts option.CompileOptions) (map[reflect.Type]bool, error) {
/* compile function */
compiler := newCompiler().apply(opts)
decoder := func(vt *rt.GoType, _ ...interface{}) (interface{}, error) {
if f, err := compiler.compileType(_vt); err != nil {
return nil, err
} else {
return f, nil
}
}
/* find or compile */
vt := rt.UnpackType(_vt)
if val := programCache.Get(vt); val != nil {
return nil, nil
} else if _, err := programCache.Compute(vt, decoder); err == nil {
return compiler.visited, nil
} else {
return nil, err
}
}
func pretouchRec(vtm map[reflect.Type]bool, opts option.CompileOptions) error {
if opts.RecursiveDepth < 0 || len(vtm) == 0 {
return nil
}
next := make(map[reflect.Type]bool)
for vt := range(vtm) {
sub, err := pretouchType(vt, opts)
if err != nil {
return err
}
for svt := range(sub) {
next[svt] = true
}
}
opts.RecursiveDepth -= 1
return pretouchRec(next, opts)
}

View File

@@ -0,0 +1,79 @@
/*
* 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 optdec
import (
"encoding/json"
"errors"
"reflect"
"strconv"
"github.com/bytedance/sonic/internal/rt"
)
/** JIT Error Helpers **/
var stackOverflow = &json.UnsupportedValueError{
Str: "Value nesting too deep",
Value: reflect.ValueOf("..."),
}
func error_type(vt *rt.GoType) error {
return &json.UnmarshalTypeError{Type: vt.Pack()}
}
func error_mismatch(node Node, ctx *context, typ reflect.Type) error {
return MismatchTypeError{
Pos: node.Position(),
Src: ctx.Parser.Json,
Type: typ,
}
}
func newUnmatched(pos int, vt *rt.GoType) error {
return MismatchTypeError{
Pos: pos,
Src: "",
Type: vt.Pack(),
}
}
func error_field(name string) error {
return errors.New("json: unknown field " + strconv.Quote(name))
}
func error_value(value string, vtype reflect.Type) error {
return &json.UnmarshalTypeError{
Type: vtype,
Value: value,
}
}
func error_syntax(pos int, src string, msg string) error {
return SyntaxError{
Pos: pos,
Src: src,
Msg: msg,
}
}
func error_unsuppoted(typ *rt.GoType) error {
return &json.UnsupportedTypeError{
Type: typ.Pack(),
}
}

View File

@@ -0,0 +1,294 @@
package optdec
import (
"encoding/json"
"math"
"unsafe"
"github.com/bytedance/sonic/internal/rt"
"github.com/bytedance/sonic/internal/resolver"
)
type decFunc interface {
FromDom(vp unsafe.Pointer, node Node, ctx *context) error
}
type ptrDecoder struct {
typ *rt.GoType
deref decFunc
}
// Pointer Value is allocated in the Caller
func (d *ptrDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*unsafe.Pointer)(vp) = nil
return nil
}
if *(*unsafe.Pointer)(vp) == nil {
*(*unsafe.Pointer)(vp) = rt.Mallocgc(d.typ.Size, d.typ, true)
}
return d.deref.FromDom(*(*unsafe.Pointer)(vp), node, ctx)
}
type embeddedFieldPtrDecoder struct {
field resolver.FieldMeta
fieldDec decFunc
fieldName string
}
// Pointer Value is allocated in the Caller
func (d *embeddedFieldPtrDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
// seek into the pointer
vp = unsafe.Pointer(uintptr(vp) - uintptr(d.field.Path[0].Size))
for _, f := range d.field.Path {
deref := rt.UnpackType(f.Type)
vp = unsafe.Pointer(uintptr(vp) + f.Size)
if f.Kind == resolver.F_deref {
if *(*unsafe.Pointer)(vp) == nil {
*(*unsafe.Pointer)(vp) = rt.Mallocgc(deref.Size, deref, true)
}
vp = *(*unsafe.Pointer)(vp)
}
}
return d.fieldDec.FromDom(vp, node, ctx)
}
type i8Decoder struct{}
func (d *i8Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
ret, ok := node.AsI64(ctx)
if !ok || ret > math.MaxInt8 || ret < math.MinInt8 {
return error_mismatch(node, ctx, int8Type)
}
*(*int8)(vp) = int8(ret)
return nil
}
type i16Decoder struct{}
func (d *i16Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
ret, ok := node.AsI64(ctx)
if !ok || ret > math.MaxInt16 || ret < math.MinInt16 {
return error_mismatch(node, ctx, int16Type)
}
*(*int16)(vp) = int16(ret)
return nil
}
type i32Decoder struct{}
func (d *i32Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
ret, ok := node.AsI64(ctx)
if !ok || ret > math.MaxInt32 || ret < math.MinInt32 {
return error_mismatch(node, ctx, int32Type)
}
*(*int32)(vp) = int32(ret)
return nil
}
type i64Decoder struct{}
func (d *i64Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
ret, ok := node.AsI64(ctx)
if !ok {
return error_mismatch(node, ctx, int64Type)
}
*(*int64)(vp) = int64(ret)
return nil
}
type u8Decoder struct{}
func (d *u8Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
ret, ok := node.AsU64(ctx)
if !ok || ret > math.MaxUint8 {
err := error_mismatch(node, ctx, uint8Type)
return err
}
*(*uint8)(vp) = uint8(ret)
return nil
}
type u16Decoder struct{}
func (d *u16Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
ret, ok := node.AsU64(ctx)
if !ok || ret > math.MaxUint16 {
return error_mismatch(node, ctx, uint16Type)
}
*(*uint16)(vp) = uint16(ret)
return nil
}
type u32Decoder struct{}
func (d *u32Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
ret, ok := node.AsU64(ctx)
if !ok || ret > math.MaxUint32 {
return error_mismatch(node, ctx, uint32Type)
}
*(*uint32)(vp) = uint32(ret)
return nil
}
type u64Decoder struct{}
func (d *u64Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
ret, ok := node.AsU64(ctx)
if !ok {
return error_mismatch(node, ctx, uint64Type)
}
*(*uint64)(vp) = uint64(ret)
return nil
}
type f32Decoder struct{}
func (d *f32Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
ret, ok := node.AsF64(ctx)
if !ok || ret > math.MaxFloat32 || ret < -math.MaxFloat32 {
return error_mismatch(node, ctx, float32Type)
}
*(*float32)(vp) = float32(ret)
return nil
}
type f64Decoder struct{}
func (d *f64Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
ret, ok := node.AsF64(ctx)
if !ok {
return error_mismatch(node, ctx, float64Type)
}
*(*float64)(vp) = float64(ret)
return nil
}
type boolDecoder struct {
}
func (d *boolDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
ret, ok := node.AsBool()
if !ok {
return error_mismatch(node, ctx, boolType)
}
*(*bool)(vp) = bool(ret)
return nil
}
type stringDecoder struct {
}
func (d *stringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
ret, ok := node.AsStr(ctx)
if !ok {
return error_mismatch(node, ctx, stringType)
}
*(*string)(vp) = ret
return nil
}
type numberDecoder struct {
}
func (d *numberDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
num, ok := node.AsNumber(ctx)
if !ok {
return error_mismatch(node, ctx, jsonNumberType)
}
*(*json.Number)(vp) = num
return nil
}
type recuriveDecoder struct {
typ *rt.GoType
}
func (d *recuriveDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
dec, err := findOrCompile(d.typ)
if err != nil {
return err
}
return dec.FromDom(vp, node, ctx)
}
type unsupportedTypeDecoder struct {
typ *rt.GoType
}
func (d *unsupportedTypeDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
return error_unsuppoted(d.typ)
}

View File

@@ -0,0 +1,95 @@
package optdec
import (
"encoding/json"
"strconv"
"github.com/bytedance/sonic/internal/native"
"github.com/bytedance/sonic/internal/utils"
"github.com/bytedance/sonic/internal/native/types"
)
func SkipNumberFast(json string, start int) (int, bool) {
// find the number ending, we parsed in native, it always valid
pos := start
for pos < len(json) && json[pos] != ']' && json[pos] != '}' && json[pos] != ',' {
if json[pos] >= '0' && json[pos] <= '9' || json[pos] == '.' || json[pos] == '-' || json[pos] == '+' || json[pos] == 'e' || json[pos] == 'E' {
pos += 1
} else {
break
}
}
// if not found number, return false
if pos == start {
return pos, false
}
return pos, true
}
// pos is the start index of the raw
func ValidNumberFast(raw string) bool {
ret := utils.SkipNumber(raw, 0)
if ret < 0 {
return false
}
// check trailing chars
for ret < len(raw) {
return false
}
return true
}
func SkipOneFast(json string, pos int) (string, error) {
start := native.SkipOneFast(&json, &pos)
if start < 0 {
return "", error_syntax(pos, json, types.ParsingError(-start).Error())
}
return json[start:pos], nil
}
func ParseI64(raw string) (int64, error) {
i64, err := strconv.ParseInt(raw, 10, 64)
if err != nil {
return 0, err
}
return i64, nil
}
func ParseBool(raw string) (bool, error) {
var b bool
err := json.Unmarshal([]byte(raw), &b)
if err != nil {
return false, err
}
return b, nil
}
func ParseU64(raw string) (uint64, error) {
u64, err := strconv.ParseUint(raw, 10, 64)
if err != nil {
return 0, err
}
return u64, nil
}
func ParseF64(raw string) (float64, error) {
f64, err := strconv.ParseFloat(raw, 64)
if err != nil {
return 0, err
}
return f64, nil
}
func Unquote(raw string) (string, error) {
var u string
err := json.Unmarshal([]byte(raw), &u)
if err != nil {
return "", err
}
return u, nil
}

View File

@@ -0,0 +1,172 @@
package optdec
import (
"encoding"
"encoding/json"
"unsafe"
"reflect"
"github.com/bytedance/sonic/internal/rt"
)
type efaceDecoder struct {
}
func (d *efaceDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
/* check the defined pointer type for issue 379 */
eface := (*rt.GoEface)(vp)
/*
not pointer type, or nil pointer, or self-pointed interface{}, such as
```go
var v interface{}
v = &v
return v
``` see `issue758_test.go`.
*/
if eface.Value == nil || eface.Type.Kind() != reflect.Ptr || eface.Value == vp {
ret, err := node.AsEface(ctx)
if err != nil {
return err
}
*(*interface{})(vp) = ret
return nil
}
if node.IsNull() {
if eface.Type.Indirect() || (!eface.Type.Indirect() && eface.Type.Pack().Elem().Kind() != reflect.Ptr) {
*(*interface{})(vp) = nil
return nil
}
}
etp := rt.PtrElem(eface.Type)
vp = eface.Value
if eface.Type.IsNamed() {
// check named pointer type, avoid call its `Unmarshaler`
newp := vp
etp = eface.Type
vp = unsafe.Pointer(&newp)
} else if !eface.Type.Indirect() {
// check direct value
etp = rt.UnpackType(eface.Type.Pack().Elem())
}
dec, err := findOrCompile(etp)
if err != nil {
return err
}
return dec.FromDom(vp, node, ctx)
}
type ifaceDecoder struct {
typ *rt.GoType
}
func (d *ifaceDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*unsafe.Pointer)(vp) = nil
return nil
}
iface := *(*rt.GoIface)(vp)
if iface.Itab == nil {
return error_type(d.typ)
}
vt := iface.Itab.Vt
if vt.Kind() != reflect.Ptr || iface.Value == nil {
return error_type(d.typ)
}
etp := rt.PtrElem(vt)
vp = iface.Value
/* check the defined pointer type for issue 379 */
if vt.IsNamed() {
newp := vp
etp = vt
vp = unsafe.Pointer(&newp)
}
dec, err := findOrCompile(etp)
if err != nil {
return err
}
return dec.FromDom(vp, node, ctx)
}
type unmarshalTextDecoder struct {
typ *rt.GoType
}
func (d *unmarshalTextDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*unsafe.Pointer)(vp) = nil
return nil
}
txt, ok := node.AsStringText(ctx)
if !ok {
return error_mismatch(node, ctx, d.typ.Pack())
}
v := *(*interface{})(unsafe.Pointer(&rt.GoEface{
Type: d.typ,
Value: vp,
}))
// fast path
if u, ok := v.(encoding.TextUnmarshaler); ok {
return u.UnmarshalText(txt)
}
// slow path
rv := reflect.ValueOf(v)
if u, ok := rv.Interface().(encoding.TextUnmarshaler); ok {
return u.UnmarshalText(txt)
}
return error_type(d.typ)
}
type unmarshalJSONDecoder struct {
typ *rt.GoType
strOpt bool
}
func (d *unmarshalJSONDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
v := *(*interface{})(unsafe.Pointer(&rt.GoEface{
Type: d.typ,
Value: vp,
}))
var input []byte
if d.strOpt && node.IsNull() {
input = []byte("null")
} else if d.strOpt {
s, ok := node.AsStringText(ctx)
if !ok {
return error_mismatch(node, ctx, d.typ.Pack())
}
input = s
} else {
input = []byte(node.AsRaw(ctx))
}
// fast path
if u, ok := v.(json.Unmarshaler); ok {
return u.UnmarshalJSON((input))
}
// slow path
rv := reflect.ValueOf(v)
if u, ok := rv.Interface().(json.Unmarshaler); ok {
return u.UnmarshalJSON(input)
}
return error_type(d.typ)
}

View File

@@ -0,0 +1,458 @@
package optdec
import (
"encoding"
"encoding/json"
"math"
"reflect"
"unsafe"
"github.com/bytedance/sonic/internal/rt"
)
/** Decoder for most common map types: map[string]interface{}, map[string]string **/
type mapEfaceDecoder struct {
}
func (d *mapEfaceDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*map[string]interface{})(vp) = nil
return nil
}
return node.AsMapEface(ctx, vp)
}
type mapStringDecoder struct {
}
func (d *mapStringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*map[string]string)(vp) = nil
return nil
}
return node.AsMapString(ctx, vp)
}
/** Decoder for map with string key **/
type mapStrKeyDecoder struct {
mapType *rt.GoMapType
elemDec decFunc
assign rt.MapStrAssign
typ reflect.Type
}
func (d *mapStrKeyDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*unsafe.Pointer)(vp) = nil
return nil
}
obj, ok := node.AsObj()
if !ok {
return error_mismatch(node, ctx, d.mapType.Pack())
}
// allocate map
m := *(*unsafe.Pointer)(vp)
if m == nil {
m = rt.Makemap(&d.mapType.GoType, obj.Len())
}
var gerr error
next := obj.Children()
for i := 0; i < obj.Len(); i++ {
keyn := NewNode(next)
key, _ := keyn.AsStr(ctx)
valn := NewNode(PtrOffset(next, 1))
valp := d.assign(d.mapType, m, key)
err := d.elemDec.FromDom(valp, valn, ctx)
if gerr == nil && err != nil {
gerr = err
}
next = valn.Next()
}
*(*unsafe.Pointer)(vp) = m
return gerr
}
/** Decoder for map with int32 or int64 key **/
type mapI32KeyDecoder struct {
mapType *rt.GoMapType
elemDec decFunc
assign rt.Map32Assign
}
func (d *mapI32KeyDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*unsafe.Pointer)(vp) = nil
return nil
}
obj, ok := node.AsObj()
if !ok {
return error_mismatch(node, ctx, d.mapType.Pack())
}
// allocate map
m := *(*unsafe.Pointer)(vp)
if m == nil {
m = rt.Makemap(&d.mapType.GoType, obj.Len())
}
next := obj.Children()
var gerr error
for i := 0; i < obj.Len(); i++ {
keyn := NewNode(next)
k, ok := keyn.ParseI64(ctx)
if !ok || k > math.MaxInt32 || k < math.MinInt32 {
if gerr == nil {
gerr = error_mismatch(keyn, ctx, d.mapType.Pack())
}
valn := NewNode(PtrOffset(next, 1))
next = valn.Next()
continue
}
key := int32(k)
ku32 := *(*uint32)(unsafe.Pointer(&key))
valn := NewNode(PtrOffset(next, 1))
valp := d.assign(d.mapType, m, ku32)
err := d.elemDec.FromDom(valp, valn, ctx)
if gerr == nil && err != nil {
gerr = err
}
next = valn.Next()
}
*(*unsafe.Pointer)(vp) = m
return gerr
}
type mapI64KeyDecoder struct {
mapType *rt.GoMapType
elemDec decFunc
assign rt.Map64Assign
}
func (d *mapI64KeyDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*unsafe.Pointer)(vp) = nil
return nil
}
obj, ok := node.AsObj()
if !ok {
return error_mismatch(node, ctx, d.mapType.Pack())
}
// allocate map
m := *(*unsafe.Pointer)(vp)
if m == nil {
m = rt.Makemap(&d.mapType.GoType, obj.Len())
}
var gerr error
next := obj.Children()
for i := 0; i < obj.Len(); i++ {
keyn := NewNode(next)
key, ok := keyn.ParseI64(ctx)
if !ok {
if gerr == nil {
gerr = error_mismatch(keyn, ctx, d.mapType.Pack())
}
valn := NewNode(PtrOffset(next, 1))
next = valn.Next()
continue
}
ku64 := *(*uint64)(unsafe.Pointer(&key))
valn := NewNode(PtrOffset(next, 1))
valp := d.assign(d.mapType, m, ku64)
err := d.elemDec.FromDom(valp, valn, ctx)
if gerr == nil && err != nil {
gerr = err
}
next = valn.Next()
}
*(*unsafe.Pointer)(vp) = m
return gerr
}
/** Decoder for map with unt32 or uint64 key **/
type mapU32KeyDecoder struct {
mapType *rt.GoMapType
elemDec decFunc
assign rt.Map32Assign
}
func (d *mapU32KeyDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*unsafe.Pointer)(vp) = nil
return nil
}
obj, ok := node.AsObj()
if !ok {
return error_mismatch(node, ctx, d.mapType.Pack())
}
// allocate map
m := *(*unsafe.Pointer)(vp)
if m == nil {
m = rt.Makemap(&d.mapType.GoType, obj.Len())
}
var gerr error
next := obj.Children()
for i := 0; i < obj.Len(); i++ {
keyn := NewNode(next)
k, ok := keyn.ParseU64(ctx)
if !ok || k > math.MaxUint32 {
if gerr == nil {
gerr = error_mismatch(keyn, ctx, d.mapType.Pack())
}
valn := NewNode(PtrOffset(next, 1))
next = valn.Next()
continue
}
key := uint32(k)
valn := NewNode(PtrOffset(next, 1))
valp := d.assign(d.mapType, m, key)
err := d.elemDec.FromDom(valp, valn, ctx)
if gerr == nil && err != nil {
gerr = err
}
next = valn.Next()
}
*(*unsafe.Pointer)(vp) = m
return gerr
}
type mapU64KeyDecoder struct {
mapType *rt.GoMapType
elemDec decFunc
assign rt.Map64Assign
}
func (d *mapU64KeyDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*unsafe.Pointer)(vp) = nil
return nil
}
obj, ok := node.AsObj()
if !ok {
return error_mismatch(node, ctx, d.mapType.Pack())
}
// allocate map
m := *(*unsafe.Pointer)(vp)
if m == nil {
m = rt.Makemap(&d.mapType.GoType, obj.Len())
}
var gerr error
next := obj.Children()
for i := 0; i < obj.Len(); i++ {
keyn := NewNode(next)
key, ok := keyn.ParseU64(ctx)
if !ok {
if gerr == nil {
gerr = error_mismatch(keyn, ctx, d.mapType.Pack())
}
valn := NewNode(PtrOffset(next, 1))
next = valn.Next()
continue
}
valn := NewNode(PtrOffset(next, 1))
valp := d.assign(d.mapType, m, key)
err := d.elemDec.FromDom(valp, valn, ctx)
if gerr == nil && err != nil {
gerr = err
}
next = valn.Next()
}
*(*unsafe.Pointer)(vp) = m
return gerr
}
/** Decoder for generic cases */
type decKey func(dec *mapDecoder, raw string) (interface{}, error)
func decodeKeyU8(dec *mapDecoder, raw string) (interface{}, error) {
key, err := Unquote(raw)
if err != nil {
return nil, err
}
ret, err := ParseU64(key)
if err != nil {
return nil, err
}
if ret > math.MaxUint8 {
return nil, error_value(key, dec.mapType.Key.Pack())
}
return uint8(ret), nil
}
func decodeKeyU16(dec *mapDecoder, raw string) (interface{}, error) {
key, err := Unquote(raw)
if err != nil {
return nil, err
}
ret, err := ParseU64(key)
if err != nil {
return nil, err
}
if ret > math.MaxUint16 {
return nil, error_value(key, dec.mapType.Key.Pack())
}
return uint16(ret), nil
}
func decodeKeyI8(dec *mapDecoder, raw string) (interface{}, error) {
key, err := Unquote(raw)
if err != nil {
return nil, err
}
ret, err := ParseI64(key)
if err != nil {
return nil, err
}
if ret > math.MaxInt8 || ret < math.MinInt8 {
return nil, error_value(key, dec.mapType.Key.Pack())
}
return int8(ret), nil
}
func decodeKeyI16(dec *mapDecoder, raw string) (interface{}, error) {
key, err := Unquote(raw)
if err != nil {
return nil, err
}
ret, err := ParseI64(key)
if err != nil {
return nil, err
}
if ret > math.MaxInt16 || ret < math.MinInt16 {
return nil, error_value(key, dec.mapType.Key.Pack())
}
return int16(ret), nil
}
func decodeKeyTextUnmarshaler(dec *mapDecoder, raw string) (interface{}, error) {
key, err := Unquote(raw)
if err != nil {
return nil, err
}
ret := reflect.New(dec.mapType.Key.Pack()).Interface()
err = ret.(encoding.TextUnmarshaler).UnmarshalText(rt.Str2Mem(key))
if err != nil {
return nil, err
}
return ret, nil
}
func decodeFloat32Key(dec *mapDecoder, raw string) (interface{}, error) {
key, err := Unquote(raw)
if err != nil {
return nil, err
}
ret, err := ParseF64(key)
if err != nil {
return nil, err
}
if ret > math.MaxFloat32 || ret < -math.MaxFloat32 {
return nil, error_value(key, dec.mapType.Key.Pack())
}
return float32(ret), nil
}
func decodeFloat64Key(dec *mapDecoder, raw string) (interface{}, error) {
key, err := Unquote(raw)
if err != nil {
return nil, err
}
return ParseF64(key)
}
func decodeJsonNumberKey(dec *mapDecoder, raw string) (interface{}, error) {
// skip the quote
raw = raw[1:len(raw)-1]
end, ok := SkipNumberFast(raw, 0)
// check trailing chars
if !ok || end != len(raw) {
return nil, error_value(raw, rt.JsonNumberType.Pack())
}
return json.Number(raw[0:end]), nil
}
type mapDecoder struct {
mapType *rt.GoMapType
keyDec decKey
elemDec decFunc
}
func (d *mapDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*unsafe.Pointer)(vp) = nil
return nil
}
obj, ok := node.AsObj()
if !ok || d.keyDec == nil {
return error_mismatch(node, ctx, d.mapType.Pack())
}
// allocate map
m := *(*unsafe.Pointer)(vp)
if m == nil {
m = rt.Makemap(&d.mapType.GoType, obj.Len())
}
next := obj.Children()
var gerr error
for i := 0; i < obj.Len(); i++ {
keyn := NewNode(next)
raw := keyn.AsRaw(ctx)
key, err := d.keyDec(d, raw)
if err != nil {
if gerr == nil {
gerr = error_mismatch(keyn, ctx, d.mapType.Pack())
}
valn := NewNode(PtrOffset(next, 1))
next = valn.Next()
continue
}
valn := NewNode(PtrOffset(next, 1))
keyp := rt.UnpackEface(key).Value
valp := rt.Mapassign(d.mapType, m, keyp)
err = d.elemDec.FromDom(valp, valn, ctx)
if gerr == nil && err != nil {
gerr = err
}
next = valn.Next()
}
*(*unsafe.Pointer)(vp) = m
return gerr
}

View File

@@ -0,0 +1,270 @@
package optdec
import (
"fmt"
"reflect"
"unsafe"
"sync"
"github.com/bytedance/sonic/internal/native"
"github.com/bytedance/sonic/internal/native/types"
"github.com/bytedance/sonic/internal/rt"
"github.com/bytedance/sonic/utf8"
)
type ErrorCode int
const (
SONIC_OK = 0;
SONIC_CONTROL_CHAR = 1;
SONIC_INVALID_ESCAPED = 2;
SONIC_INVALID_NUM = 3;
SONIC_FLOAT_INF = 4;
SONIC_EOF = 5;
SONIC_INVALID_CHAR = 6;
SONIC_EXPECT_KEY = 7;
SONIC_EXPECT_COLON = 8;
SONIC_EXPECT_OBJ_COMMA_OR_END = 9;
SONIC_EXPECT_ARR_COMMA_OR_END = 10;
SONIC_VISIT_FAILED = 11;
SONIC_INVALID_ESCAPED_UTF = 12;
SONIC_INVALID_LITERAL = 13;
SONIC_STACK_OVERFLOW = 14;
)
var ParsingErrors = []string{
SONIC_OK : "ok",
SONIC_CONTROL_CHAR : "control chars in string",
SONIC_INVALID_ESCAPED : "invalid escaped chars in string",
SONIC_INVALID_NUM : "invalid number",
SONIC_FLOAT_INF : "float infinity",
SONIC_EOF : "eof",
SONIC_INVALID_CHAR : "invalid chars",
SONIC_EXPECT_KEY : "expect a json key",
SONIC_EXPECT_COLON : "expect a `:`",
SONIC_EXPECT_OBJ_COMMA_OR_END : "expect a `,` or `}`",
SONIC_EXPECT_ARR_COMMA_OR_END : "expect a `,` or `]`",
SONIC_VISIT_FAILED : "failed in json visitor",
SONIC_INVALID_ESCAPED_UTF : "invalid escaped unicodes",
SONIC_INVALID_LITERAL : "invalid literal(true/false/null)",
SONIC_STACK_OVERFLOW : "json is exceeded max depth 4096, cause stack overflow",
}
func (code ErrorCode) Error() string {
return ParsingErrors[code]
}
type node struct {
typ uint64
val uint64
}
// should consistent with native/parser.c
type _nospaceBlock struct {
_ [8]byte
_ [8]byte
}
// should consistent with native/parser.c
type nodeBuf struct {
ncur uintptr
parent int64
depth uint64
nstart uintptr
nend uintptr
iskey bool
stat jsonStat
}
func (self *nodeBuf) init(nodes []node) {
self.ncur = uintptr(unsafe.Pointer(&nodes[0]))
self.nstart = self.ncur
self.nend = self.ncur + uintptr(cap(nodes)) * unsafe.Sizeof(node{})
self.parent = -1
}
// should consistent with native/parser.c
type Parser struct {
Json string
padded []byte
nodes []node
dbuf []byte
backup []node
options uint64
// JSON cursor
start uintptr
cur uintptr
end uintptr
_nbk _nospaceBlock
// node buffer cursor
nbuf nodeBuf
Utf8Inv bool
isEface bool
}
// only when parse non-empty object/array are needed.
type jsonStat struct {
object uint32
array uint32
str uint32
number uint32
array_elems uint32
object_keys uint32
max_depth uint32
}
var (
defaultJsonPaddedCap uintptr = 1 << 20 // 1 Mb
defaultNodesCap uintptr = (1 << 20) / unsafe.Sizeof(node{}) // 1 Mb
)
var parsePool sync.Pool = sync.Pool {
New: func () interface{} {
return &Parser{
options: 0,
padded: make([]byte, 0, defaultJsonPaddedCap),
nodes: make([]node, defaultNodesCap, defaultNodesCap),
dbuf: make([]byte, types.MaxDigitNums, types.MaxDigitNums),
}
},
}
var padding string = "x\"x\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
func newParser(data string, pos int, opt uint64) *Parser {
p := parsePool.Get().(*Parser)
/* validate json if needed */
if (opt & (1 << _F_validate_string)) != 0 && !utf8.ValidateString(data){
dbuf := utf8.CorrectWith(nil, rt.Str2Mem(data[pos:]), "\ufffd")
dbuf = append(dbuf, padding...)
p.Json = rt.Mem2Str(dbuf[:len(dbuf) - len(padding)])
p.Utf8Inv = true
p.start = uintptr((*rt.GoString)(unsafe.Pointer(&p.Json)).Ptr)
} else {
p.Json = data
// TODO: prevent too large JSON
p.padded = append(p.padded, data[pos:]...)
p.padded = append(p.padded, padding...)
p.start = uintptr((*rt.GoSlice)(unsafe.Pointer(&p.padded)).Ptr)
}
p.cur = p.start
p.end = p.cur + uintptr(len(p.Json))
p.options = opt
p.nbuf.init(p.nodes)
return p
}
func (p *Parser) Pos() int {
return int(p.cur - p.start)
}
func (p *Parser) JsonBytes() []byte {
if p.Utf8Inv {
return (rt.Str2Mem(p.Json))
} else {
return p.padded
}
}
var nodeType = rt.UnpackType(reflect.TypeOf(node{}))
//go:inline
func calMaxNodeCap(jsonSize int) int {
return jsonSize / 2 + 2
}
func (p *Parser) parse() ErrorCode {
// when decode into struct, we should decode number as possible
old := p.options
if !p.isEface {
p.options &^= 1 << _F_use_number
}
// fast path with limited node buffer
err := ErrorCode(native.ParseWithPadding(unsafe.Pointer(p)))
if err != SONIC_VISIT_FAILED {
p.options = old
return err
}
// check OoB here
offset := p.nbuf.ncur - p.nbuf.nstart
curLen := int(offset / unsafe.Sizeof(node{}))
if curLen != len(p.nodes) {
panic(fmt.Sprintf("current len: %d, real len: %d cap: %d", curLen, len(p.nodes), cap(p.nodes)))
}
// node buf is not enough, continue parse
// the maxCap is always meet all valid JSON
maxCap := curLen + calMaxNodeCap(len(p.Json) - int(p.cur - p.start))
slice := rt.GoSlice{
Ptr: rt.Mallocgc(uintptr(maxCap) * nodeType.Size, nodeType, false),
Len: maxCap,
Cap: maxCap,
}
rt.Memmove(unsafe.Pointer(slice.Ptr), unsafe.Pointer(&p.nodes[0]), offset)
p.backup = p.nodes
p.nodes = *(*[]node)(unsafe.Pointer(&slice))
// update node cursor
p.nbuf.nstart = uintptr(unsafe.Pointer(&p.nodes[0]))
p.nbuf.nend = p.nbuf.nstart + uintptr(cap(p.nodes)) * unsafe.Sizeof(node{})
p.nbuf.ncur = p.nbuf.nstart + offset
// continue parse json
err = ErrorCode(native.ParseWithPadding(unsafe.Pointer(p)))
p.options = old
return err
}
func (p *Parser) reset() {
p.options = 0
p.padded = p.padded[:0]
// nodes is too large here, we will not reset it and use small backup nodes buffer
if p.backup != nil {
p.nodes = p.backup
p.backup = nil
}
p.start = 0
p.cur = 0
p.end = 0
p.Json = ""
p.nbuf = nodeBuf{}
p._nbk = _nospaceBlock{}
p.Utf8Inv = false
p.isEface = false
}
func (p *Parser) free() {
p.reset()
parsePool.Put(p)
}
//go:noinline
func (p *Parser) fixError(code ErrorCode) error {
if code == SONIC_OK {
return nil
}
if p.Pos() == 0 {
code = SONIC_EOF;
}
pos := p.Pos() - 1
return error_syntax(pos, p.Json, ParsingErrors[code])
}
func Parse(data string, opt uint64) error {
p := newParser(data, 0, opt)
err := p.parse()
p.free()
return err
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,235 @@
package optdec
import (
"reflect"
"unsafe"
"github.com/bytedance/sonic/internal/rt"
)
type sliceDecoder struct {
elemType *rt.GoType
elemDec decFunc
typ reflect.Type
}
var (
emptyPtr = &struct{}{}
)
func (d *sliceDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*rt.GoSlice)(vp) = rt.GoSlice{}
return nil
}
arr, ok := node.AsArr()
if !ok {
return error_mismatch(node, ctx, d.typ)
}
slice := rt.MakeSlice(vp, d.elemType, arr.Len())
elems := slice.Ptr
next := arr.Children()
var gerr error
for i := 0; i < arr.Len(); i++ {
val := NewNode(next)
elem := unsafe.Pointer(uintptr(elems) + uintptr(i)*d.elemType.Size)
err := d.elemDec.FromDom(elem, val, ctx)
if gerr == nil && err != nil {
gerr = err
}
next = val.Next()
}
*(*rt.GoSlice)(vp) = *slice
return gerr
}
type arrayDecoder struct {
len int
elemType *rt.GoType
elemDec decFunc
typ reflect.Type
}
//go:nocheckptr
func (d *arrayDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
arr, ok := node.AsArr()
if !ok {
return error_mismatch(node, ctx, d.typ)
}
next := arr.Children()
i := 0
var gerr error
for ; i < d.len && i < arr.Len(); i++ {
elem := unsafe.Pointer(uintptr(vp) + uintptr(i)*d.elemType.Size)
val := NewNode(next)
err := d.elemDec.FromDom(elem, val, ctx)
if gerr == nil && err != nil {
gerr = err
}
next = val.Next()
}
/* zero rest of array */
addr := uintptr(vp) + uintptr(i)*d.elemType.Size
n := uintptr(d.len-i) * d.elemType.Size
/* the boundary pointer may points to another unknown object, so we need to avoid using it */
if n != 0 {
rt.ClearMemory(d.elemType, unsafe.Pointer(addr), n)
}
return gerr
}
type sliceEfaceDecoder struct {
}
func (d *sliceEfaceDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*rt.GoSlice)(vp) = rt.GoSlice{}
return nil
}
/* if slice is empty, just call `AsSliceEface` */
if ((*rt.GoSlice)(vp)).Len == 0 {
return node.AsSliceEface(ctx, vp)
}
decoder := sliceDecoder{
elemType: rt.AnyType,
elemDec: &efaceDecoder{},
typ: rt.SliceEfaceType.Pack(),
}
return decoder.FromDom(vp, node, ctx)
}
type sliceI32Decoder struct {
}
func (d *sliceI32Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*rt.GoSlice)(vp) = rt.GoSlice{}
return nil
}
return node.AsSliceI32(ctx, vp)
}
type sliceI64Decoder struct {
}
func (d *sliceI64Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*rt.GoSlice)(vp) = rt.GoSlice{}
return nil
}
return node.AsSliceI64(ctx, vp)
}
type sliceU32Decoder struct {
}
func (d *sliceU32Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*rt.GoSlice)(vp) = rt.GoSlice{}
return nil
}
return node.AsSliceU32(ctx, vp)
}
type sliceU64Decoder struct {
}
func (d *sliceU64Decoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*rt.GoSlice)(vp) = rt.GoSlice{}
return nil
}
return node.AsSliceU64(ctx, vp)
}
type sliceStringDecoder struct {
}
func (d *sliceStringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*rt.GoSlice)(vp) = rt.GoSlice{}
return nil
}
return node.AsSliceString(ctx, vp)
}
type sliceBytesDecoder struct {
}
func (d *sliceBytesDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*rt.GoSlice)(vp) = rt.GoSlice{}
return nil
}
s, err := node.AsSliceBytes(ctx)
*(*[]byte)(vp) = s
return err
}
type sliceBytesUnmarshalerDecoder struct {
elemType *rt.GoType
elemDec decFunc
typ reflect.Type
}
func (d *sliceBytesUnmarshalerDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*rt.GoSlice)(vp) = rt.GoSlice{}
return nil
}
/* parse JSON string into `[]byte` */
if node.IsStr() {
slice, err := node.AsSliceBytes(ctx)
if err != nil {
return err
}
*(*[]byte)(vp) = slice
return nil
}
/* parse JSON array into `[]byte` */
arr, ok := node.AsArr()
if !ok {
return error_mismatch(node, ctx, d.typ)
}
slice := rt.MakeSlice(vp, d.elemType, arr.Len())
elems := slice.Ptr
var gerr error
next := arr.Children()
for i := 0; i < arr.Len(); i++ {
child := NewNode(next)
elem := unsafe.Pointer(uintptr(elems) + uintptr(i)*d.elemType.Size)
err := d.elemDec.FromDom(elem, child, ctx)
if gerr == nil && err != nil {
gerr = err
}
next = child.Next()
}
*(*rt.GoSlice)(vp) = *slice
return gerr
}

View File

@@ -0,0 +1,360 @@
package optdec
import (
"encoding/json"
"math"
"unsafe"
"github.com/bytedance/sonic/internal/rt"
)
type ptrStrDecoder struct {
typ *rt.GoType
deref decFunc
}
// Pointer Value is allocated in the Caller
func (d *ptrStrDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
*(*unsafe.Pointer)(vp) = nil
return nil
}
s, ok := node.AsStrRef(ctx)
if !ok {
return error_mismatch(node, ctx, stringType)
}
if s == "null" {
*(*unsafe.Pointer)(vp) = nil
return nil
}
if *(*unsafe.Pointer)(vp) == nil {
*(*unsafe.Pointer)(vp) = rt.Mallocgc(d.typ.Size, d.typ, true)
}
return d.deref.FromDom(*(*unsafe.Pointer)(vp), node, ctx)
}
type boolStringDecoder struct {
}
func (d *boolStringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
s, ok := node.AsStrRef(ctx)
if !ok {
return error_mismatch(node, ctx, stringType)
}
if s == "null" {
return nil
}
b, err := ParseBool(s)
if err != nil {
return error_mismatch(node, ctx, boolType)
}
*(*bool)(vp) = b
return nil
}
func parseI64(node Node, ctx *context) (int64, error, bool) {
if node.IsNull() {
return 0, nil, true
}
s, ok := node.AsStrRef(ctx)
if !ok {
return 0, error_mismatch(node, ctx, stringType), false
}
if s == "null" {
return 0, nil, true
}
ret, err := ParseI64(s)
return ret, err, false
}
type i8StringDecoder struct{}
func (d *i8StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
ret, err, null := parseI64(node, ctx)
if null {
return nil
}
if err != nil {
return err
}
if ret > math.MaxInt8 || ret < math.MinInt8 {
return error_mismatch(node, ctx, int8Type)
}
*(*int8)(vp) = int8(ret)
return nil
}
type i16StringDecoder struct{}
func (d *i16StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
ret, err, null := parseI64(node, ctx)
if null {
return nil
}
if err != nil {
return err
}
if ret > math.MaxInt16 || ret < math.MinInt16 {
return error_mismatch(node, ctx, int16Type)
}
*(*int16)(vp) = int16(ret)
return nil
}
type i32StringDecoder struct{}
func (d *i32StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
ret, err, null := parseI64(node, ctx)
if null {
return nil
}
if err != nil {
return err
}
if ret > math.MaxInt32 || ret < math.MinInt32 {
return error_mismatch(node, ctx, int32Type)
}
*(*int32)(vp) = int32(ret)
return nil
}
type i64StringDecoder struct{}
func (d *i64StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
ret, err, null := parseI64(node, ctx)
if null {
return nil
}
if err != nil {
return err
}
*(*int64)(vp) = int64(ret)
return nil
}
func parseU64(node Node, ctx *context) (uint64, error, bool) {
if node.IsNull() {
return 0, nil, true
}
s, ok := node.AsStrRef(ctx)
if !ok {
return 0, error_mismatch(node, ctx, stringType), false
}
if s == "null" {
return 0, nil, true
}
ret, err := ParseU64(s)
return ret, err, false
}
type u8StringDecoder struct{}
func (d *u8StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
ret, err, null := parseU64(node, ctx)
if null {
return nil
}
if err != nil {
return err
}
if ret > math.MaxUint8 {
return error_mismatch(node, ctx, uint8Type)
}
*(*uint8)(vp) = uint8(ret)
return nil
}
type u16StringDecoder struct{}
func (d *u16StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
ret, err, null := parseU64(node, ctx)
if null {
return nil
}
if err != nil {
return err
}
if ret > math.MaxUint16 {
return error_mismatch(node, ctx, uint16Type)
}
*(*uint16)(vp) = uint16(ret)
return nil
}
type u32StringDecoder struct{}
func (d *u32StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
ret, err, null := parseU64(node, ctx)
if null {
return nil
}
if err != nil {
return err
}
if ret > math.MaxUint32 {
return error_mismatch(node, ctx, uint32Type)
}
*(*uint32)(vp) = uint32(ret)
return nil
}
type u64StringDecoder struct{}
func (d *u64StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
ret, err, null := parseU64(node, ctx)
if null {
return nil
}
if err != nil {
return err
}
*(*uint64)(vp) = uint64(ret)
return nil
}
type f32StringDecoder struct{}
func (d *f32StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
s, ok := node.AsStrRef(ctx)
if !ok {
return error_mismatch(node, ctx, stringType)
}
if s == "null" {
return nil
}
ret, err := ParseF64(s)
if err != nil || ret > math.MaxFloat32 || ret < -math.MaxFloat32 {
return error_mismatch(node, ctx, float32Type)
}
*(*float32)(vp) = float32(ret)
return nil
}
type f64StringDecoder struct{}
func (d *f64StringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
s, ok := node.AsStrRef(ctx)
if !ok {
return error_mismatch(node, ctx, stringType)
}
if s == "null" {
return nil
}
ret, err := ParseF64(s)
if err != nil {
return error_mismatch(node, ctx, float64Type)
}
*(*float64)(vp) = float64(ret)
return nil
}
/* parse string field with string options */
type strStringDecoder struct{}
func (d *strStringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
s, ok := node.AsStrRef(ctx)
if !ok {
return error_mismatch(node, ctx, stringType)
}
if s == "null" {
return nil
}
s, err := Unquote(s)
if err != nil {
return error_mismatch(node, ctx, stringType)
}
*(*string)(vp) = s
return nil
}
type numberStringDecoder struct{}
func (d *numberStringDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
s, ok := node.AsStrRef(ctx)
if !ok {
return error_mismatch(node, ctx, stringType)
}
if s == "null" {
return nil
}
num, ok := node.ParseNumber(ctx)
if !ok {
return error_mismatch(node, ctx, jsonNumberType)
}
end, ok := SkipNumberFast(s, 0)
// has error or trailing chars
if !ok || end != len(s) {
return error_mismatch(node, ctx, jsonNumberType)
}
*(*json.Number)(vp) = json.Number(num)
return nil
}

View File

@@ -0,0 +1,62 @@
package optdec
import (
"reflect"
"unsafe"
"github.com/bytedance/sonic/internal/decoder/consts"
caching "github.com/bytedance/sonic/internal/optcaching"
"github.com/bytedance/sonic/internal/resolver"
)
type fieldEntry struct {
resolver.FieldMeta
fieldDec decFunc
}
type structDecoder struct {
fieldMap caching.FieldLookup
fields []fieldEntry
structName string
typ reflect.Type
}
func (d *structDecoder) FromDom(vp unsafe.Pointer, node Node, ctx *context) error {
if node.IsNull() {
return nil
}
var gerr error
obj, ok := node.AsObj()
if !ok {
return error_mismatch(node, ctx, d.typ)
}
next := obj.Children()
for i := 0; i < obj.Len(); i++ {
key, _ := NewNode(next).AsStrRef(ctx)
val := NewNode(PtrOffset(next, 1))
next = val.Next()
// find field idx
idx := d.fieldMap.Get(key, ctx.Options()&uint64(consts.OptionCaseSensitive) != 0)
if idx == -1 {
if Options(ctx.Options())&OptionDisableUnknown != 0 {
return error_field(key)
}
continue
}
offset := d.fields[idx].Path[0].Size
elem := unsafe.Pointer(uintptr(vp) + offset)
err := d.fields[idx].fieldDec.FromDom(elem, val, ctx)
// deal with mismatch type errors
if gerr == nil && err != nil {
// TODO: better error info
gerr = err
}
}
return gerr
}

View File

@@ -0,0 +1,60 @@
/*
* 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 optdec
import (
"encoding"
"encoding/base64"
"encoding/json"
"reflect"
"unsafe"
"github.com/bytedance/sonic/internal/rt"
)
var (
boolType = reflect.TypeOf(bool(false))
byteType = reflect.TypeOf(byte(0))
intType = reflect.TypeOf(int(0))
int8Type = reflect.TypeOf(int8(0))
int16Type = reflect.TypeOf(int16(0))
int32Type = reflect.TypeOf(int32(0))
int64Type = reflect.TypeOf(int64(0))
uintType = reflect.TypeOf(uint(0))
uint8Type = reflect.TypeOf(uint8(0))
uint16Type = reflect.TypeOf(uint16(0))
uint32Type = reflect.TypeOf(uint32(0))
uint64Type = reflect.TypeOf(uint64(0))
float32Type = reflect.TypeOf(float32(0))
float64Type = reflect.TypeOf(float64(0))
stringType = reflect.TypeOf("")
bytesType = reflect.TypeOf([]byte(nil))
jsonNumberType = reflect.TypeOf(json.Number(""))
base64CorruptInputError = reflect.TypeOf(base64.CorruptInputError(0))
anyType = rt.UnpackType(reflect.TypeOf((*interface{})(nil)).Elem())
)
var (
errorType = reflect.TypeOf((*error)(nil)).Elem()
jsonUnmarshalerType = reflect.TypeOf((*json.Unmarshaler)(nil)).Elem()
encodingTextUnmarshalerType = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem()
)
func rtype(t reflect.Type) (*rt.GoItab, *rt.GoType) {
p := (*rt.GoIface)(unsafe.Pointer(&t))
return p.Itab, (*rt.GoType)(p.Value)
}

View File

@@ -0,0 +1,285 @@
/*
* 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 alg
import (
"encoding"
"reflect"
"strconv"
"sync"
"unsafe"
"github.com/bytedance/sonic/internal/encoder/vars"
"github.com/bytedance/sonic/internal/rt"
)
type _MapPair struct {
k string // when the map key is integer, k is pointed to m
v unsafe.Pointer
m [32]byte
}
type MapIterator struct {
It rt.GoMapIterator // must be the first field
kv rt.GoSlice // slice of _MapPair
ki int
}
var (
iteratorPool = sync.Pool{}
iteratorPair = rt.UnpackType(reflect.TypeOf(_MapPair{}))
)
func init() {
if unsafe.Offsetof(MapIterator{}.It) != 0 {
panic("_MapIterator.it is not the first field")
}
}
func newIterator() *MapIterator {
if v := iteratorPool.Get(); v == nil {
return new(MapIterator)
} else {
return resetIterator(v.(*MapIterator))
}
}
func resetIterator(p *MapIterator) *MapIterator {
p.ki = 0
p.It = rt.GoMapIterator{}
p.kv.Len = 0
return p
}
func (self *MapIterator) at(i int) *_MapPair {
return (*_MapPair)(unsafe.Pointer(uintptr(self.kv.Ptr) + uintptr(i) * unsafe.Sizeof(_MapPair{})))
}
func (self *MapIterator) add() (p *_MapPair) {
p = self.at(self.kv.Len)
self.kv.Len++
return
}
func (self *MapIterator) data() (p []_MapPair) {
*(*rt.GoSlice)(unsafe.Pointer(&p)) = self.kv
return
}
func (self *MapIterator) append(t *rt.GoType, k unsafe.Pointer, v unsafe.Pointer) (err error) {
p := self.add()
p.v = v
tk := t.Kind()
// followed as `encoding/json/emcode.go:resolveKeyName
if tk == reflect.String {
p.k = *(*string)(k)
return nil
}
// check if the key implements the encoding.TextMarshaler interface
if t.Pack().Implements(vars.EncodingTextMarshalerType) {
if tk != reflect.Interface {
return self.appendConcrete(p, t, k)
} else {
return self.appendInterface(p, t, k)
}
}
return self.appendGeneric(p, t, tk, k)
}
func (self *MapIterator) appendGeneric(p *_MapPair, t *rt.GoType, v reflect.Kind, k unsafe.Pointer) error {
switch v {
case reflect.Int : p.k = rt.Mem2Str(strconv.AppendInt(p.m[:0], int64(*(*int)(k)), 10)) ; return nil
case reflect.Int8 : p.k = rt.Mem2Str(strconv.AppendInt(p.m[:0], int64(*(*int8)(k)), 10)) ; return nil
case reflect.Int16 : p.k = rt.Mem2Str(strconv.AppendInt(p.m[:0], int64(*(*int16)(k)), 10)) ; return nil
case reflect.Int32 : p.k = rt.Mem2Str(strconv.AppendInt(p.m[:0], int64(*(*int32)(k)), 10)) ; return nil
case reflect.Int64 : p.k = rt.Mem2Str(strconv.AppendInt(p.m[:0], int64(*(*int64)(k)), 10)) ; return nil
case reflect.Uint : p.k = rt.Mem2Str(strconv.AppendUint(p.m[:0], uint64(*(*uint)(k)), 10)) ; return nil
case reflect.Uint8 : p.k = rt.Mem2Str(strconv.AppendUint(p.m[:0], uint64(*(*uint8)(k)), 10)) ; return nil
case reflect.Uint16 : p.k = rt.Mem2Str(strconv.AppendUint(p.m[:0], uint64(*(*uint16)(k)), 10)) ; return nil
case reflect.Uint32 : p.k = rt.Mem2Str(strconv.AppendUint(p.m[:0], uint64(*(*uint32)(k)), 10)) ; return nil
case reflect.Uint64 : p.k = rt.Mem2Str(strconv.AppendUint(p.m[:0], uint64(*(*uint64)(k)), 10)) ; return nil
case reflect.Uintptr : p.k = rt.Mem2Str(strconv.AppendUint(p.m[:0], uint64(*(*uintptr)(k)), 10)) ; return nil
case reflect.Bool : if *(*bool)(k) { p.k = "true" } else { p.k = "false" }; return nil
default : return vars.Error_type(t.Pack())
}
}
func (self *MapIterator) appendConcrete(p *_MapPair, t *rt.GoType, k unsafe.Pointer) error {
// compiler has already checked that the type implements the encoding.MarshalText interface
if !t.Indirect() {
k = *(*unsafe.Pointer)(k)
}
// check the TextMarshaler interface
eface := rt.GoEface{Value: k, Type: t}.Pack()
e, ok := eface.(encoding.TextMarshaler)
if !ok {
return vars.Error_type(t.Pack())
}
// check for nil pointer
if t.Kind() == reflect.Ptr && k == nil {
p.k = ""
return nil
}
out, err := e.MarshalText()
if err != nil {
return err
}
p.k = rt.Mem2Str(out)
return nil
}
func (self *MapIterator) appendInterface(p *_MapPair, t *rt.GoType, k unsafe.Pointer) (err error) {
if len(rt.IfaceType(t).Methods) == 0 {
panic("unexpected map key type")
}
p.k, err = asText(k)
return
}
func IteratorStop(p *MapIterator) {
iteratorPool.Put(p)
}
func IteratorNext(p *MapIterator) {
i := p.ki
t := &p.It
/* check for unordered iteration */
if i < 0 {
rt.Mapiternext(t)
return
}
/* check for end of iteration */
if p.ki >= p.kv.Len {
t.K = nil
t.V = nil
return
}
/* update the key-value pair, and increase the pointer */
t.K = unsafe.Pointer(&p.at(p.ki).k)
t.V = p.at(p.ki).v
p.ki++
}
func IteratorStart(t *rt.GoMapType, m unsafe.Pointer, fv uint64) (*MapIterator, error) {
it := newIterator()
rt.Mapiterinit(t, m, &it.It)
count := rt.Maplen(m)
/* check for key-sorting, empty map don't need sorting */
if count == 0 || (fv & (1<<BitSortMapKeys)) == 0 {
it.ki = -1
return it, nil
}
/* pre-allocate space if needed */
if count > it.kv.Cap {
it.kv = rt.GrowSlice(iteratorPair, it.kv, count)
}
/* dump all the key-value pairs */
for ; it.It.K != nil; rt.Mapiternext(&it.It) {
if err := it.append(t.Key, it.It.K, it.It.V); err != nil {
IteratorStop(it)
return nil, err
}
}
/* sort the keys, map with only 1 item don't need sorting */
if it.ki = 1; count > 1 {
radixQsort(it.data(), 0, maxDepth(it.kv.Len))
}
/* load the first pair into iterator */
it.It.V = it.at(0).v
it.It.K = unsafe.Pointer(&it.at(0).k)
return it, nil
}
func asText(v unsafe.Pointer) (string, error) {
text := rt.AssertI2I(rt.UnpackType(vars.EncodingTextMarshalerType), *(*rt.GoIface)(v))
r, e := (*(*encoding.TextMarshaler)(unsafe.Pointer(&text))).MarshalText()
return rt.Mem2Str(r), e
}
func IsValidNumber(s string) bool {
// This function implements the JSON numbers grammar.
// See https://tools.ietf.org/html/rfc7159#section-6
// and https://www.json.org/img/number.png
if s == "" {
return false
}
// Optional -
if s[0] == '-' {
s = s[1:]
if s == "" {
return false
}
}
// Digits
switch {
default:
return false
case s[0] == '0':
s = s[1:]
case '1' <= s[0] && s[0] <= '9':
s = s[1:]
for len(s) > 0 && '0' <= s[0] && s[0] <= '9' {
s = s[1:]
}
}
// . followed by 1 or more digits.
if len(s) >= 2 && s[0] == '.' && '0' <= s[1] && s[1] <= '9' {
s = s[2:]
for len(s) > 0 && '0' <= s[0] && s[0] <= '9' {
s = s[1:]
}
}
// e or E followed by an optional - or + and
// 1 or more digits.
if len(s) >= 2 && (s[0] == 'e' || s[0] == 'E') {
s = s[1:]
if s[0] == '+' || s[0] == '-' {
s = s[1:]
if s == "" {
return false
}
}
for len(s) > 0 && '0' <= s[0] && s[0] <= '9' {
s = s[1:]
}
}
// Make sure we are at the end.
return s == ""
}

View File

@@ -0,0 +1,31 @@
/**
* Copyright 2024 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 alg
const (
BitSortMapKeys = iota
BitEscapeHTML
BitCompactMarshaler
BitNoQuoteTextMarshaler
BitNoNullSliceOrMap
BitValidateString
BitNoValidateJSONMarshaler
BitNoEncoderNewline
BitEncodeNullForInfOrNan
BitPointerValue = 63
)

View File

@@ -0,0 +1,206 @@
/*
* 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 alg
// Algorithm 3-way Radix Quicksort, d means the radix.
// Reference: https://algs4.cs.princeton.edu/51radix/Quick3string.java.html
func radixQsort(kvs []_MapPair, d, maxDepth int) {
for len(kvs) > 11 {
// To avoid the worst case of quickSort (time: O(n^2)), use introsort here.
// Reference: https://en.wikipedia.org/wiki/Introsort and
// https://github.com/golang/go/issues/467
if maxDepth == 0 {
heapSort(kvs, 0, len(kvs))
return
}
maxDepth--
p := pivot(kvs, d)
lt, i, gt := 0, 0, len(kvs)
for i < gt {
c := byteAt(kvs[i].k, d)
if c < p {
swap(kvs, lt, i)
i++
lt++
} else if c > p {
gt--
swap(kvs, i, gt)
} else {
i++
}
}
// kvs[0:lt] < v = kvs[lt:gt] < kvs[gt:len(kvs)]
// Native implementation:
// radixQsort(kvs[:lt], d, maxDepth)
// if p > -1 {
// radixQsort(kvs[lt:gt], d+1, maxDepth)
// }
// radixQsort(kvs[gt:], d, maxDepth)
// Optimize as follows: make recursive calls only for the smaller parts.
// Reference: https://www.geeksforgeeks.org/quicksort-tail-call-optimization-reducing-worst-case-space-log-n/
if p == -1 {
if lt > len(kvs) - gt {
radixQsort(kvs[gt:], d, maxDepth)
kvs = kvs[:lt]
} else {
radixQsort(kvs[:lt], d, maxDepth)
kvs = kvs[gt:]
}
} else {
ml := maxThree(lt, gt-lt, len(kvs)-gt)
if ml == lt {
radixQsort(kvs[lt:gt], d+1, maxDepth)
radixQsort(kvs[gt:], d, maxDepth)
kvs = kvs[:lt]
} else if ml == gt-lt {
radixQsort(kvs[:lt], d, maxDepth)
radixQsort(kvs[gt:], d, maxDepth)
kvs = kvs[lt:gt]
d += 1
} else {
radixQsort(kvs[:lt], d, maxDepth)
radixQsort(kvs[lt:gt], d+1, maxDepth)
kvs = kvs[gt:]
}
}
}
insertRadixSort(kvs, d)
}
func insertRadixSort(kvs []_MapPair, d int) {
for i := 1; i < len(kvs); i++ {
for j := i; j > 0 && lessFrom(kvs[j].k, kvs[j-1].k, d); j-- {
swap(kvs, j, j-1)
}
}
}
func pivot(kvs []_MapPair, d int) int {
m := len(kvs) >> 1
if len(kvs) > 40 {
// Tukey's ``Ninther,'' median of three mediankvs of three.
t := len(kvs) / 8
return medianThree(
medianThree(byteAt(kvs[0].k, d), byteAt(kvs[t].k, d), byteAt(kvs[2*t].k, d)),
medianThree(byteAt(kvs[m].k, d), byteAt(kvs[m-t].k, d), byteAt(kvs[m+t].k, d)),
medianThree(byteAt(kvs[len(kvs)-1].k, d),
byteAt(kvs[len(kvs)-1-t].k, d),
byteAt(kvs[len(kvs)-1-2*t].k, d)))
}
return medianThree(byteAt(kvs[0].k, d), byteAt(kvs[m].k, d), byteAt(kvs[len(kvs)-1].k, d))
}
func medianThree(i, j, k int) int {
if i > j {
i, j = j, i
} // i < j
if k < i {
return i
}
if k > j {
return j
}
return k
}
func maxThree(i, j, k int) int {
max := i
if max < j {
max = j
}
if max < k {
max = k
}
return max
}
// maxDepth returns a threshold at which quicksort should switch
// to heapsort. It returnkvs 2*ceil(lg(n+1)).
func maxDepth(n int) int {
var depth int
for i := n; i > 0; i >>= 1 {
depth++
}
return depth * 2
}
// siftDown implements the heap property on kvs[lo:hi].
// first is an offset into the array where the root of the heap lies.
func siftDown(kvs []_MapPair, lo, hi, first int) {
root := lo
for {
child := 2*root + 1
if child >= hi {
break
}
if child+1 < hi && kvs[first+child].k < kvs[first+child+1].k {
child++
}
if kvs[first+root].k >= kvs[first+child].k {
return
}
swap(kvs, first+root, first+child)
root = child
}
}
func heapSort(kvs []_MapPair, a, b int) {
first := a
lo := 0
hi := b - a
// Build heap with the greatest element at top.
for i := (hi - 1) / 2; i >= 0; i-- {
siftDown(kvs, i, hi, first)
}
// Pop elements, the largest first, into end of kvs.
for i := hi - 1; i >= 0; i-- {
swap(kvs, first, first+i)
siftDown(kvs, lo, i, first)
}
}
// Note that _MapPair.k is NOT pointed to _MapPair.m when map key is integer after swap
func swap(kvs []_MapPair, a, b int) {
kvs[a].k, kvs[b].k = kvs[b].k, kvs[a].k
kvs[a].v, kvs[b].v = kvs[b].v, kvs[a].v
}
// Compare two strings from the pos d.
func lessFrom(a, b string, d int) bool {
l := len(a)
if l > len(b) {
l = len(b)
}
for i := d; i < l; i++ {
if a[i] == b[i] {
continue
}
return a[i] < b[i]
}
return len(a) < len(b)
}
func byteAt(b string, p int) int {
if p < len(b) {
return int(b[p])
}
return -1
}

View File

@@ -0,0 +1,189 @@
//go:build (amd64 && go1.16 && !go1.27) || (arm64 && go1.20 && !go1.27)
// +build amd64,go1.16,!go1.27 arm64,go1.20,!go1.27
/**
* Copyright 2024 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 alg
import (
"runtime"
"strconv"
"unsafe"
"github.com/bytedance/sonic/internal/native"
"github.com/bytedance/sonic/internal/native/types"
"github.com/bytedance/sonic/internal/rt"
)
// Valid validates json and returns first non-blank character position,
// if it is only one valid json value.
// Otherwise returns invalid character position using start.
//
// Note: it does not check for the invalid UTF-8 characters.
func Valid(data []byte) (ok bool, start int) {
n := len(data)
if n == 0 {
return false, -1
}
s := rt.Mem2Str(data)
p := 0
m := types.NewStateMachine()
ret := native.ValidateOne(&s, &p, m, 0)
types.FreeStateMachine(m)
if ret < 0 {
return false, p-1
}
/* check for trailing spaces */
for ;p < n; p++ {
if (types.SPACE_MASK & (1 << data[p])) == 0 {
return false, p
}
}
return true, ret
}
var typeByte = rt.UnpackEface(byte(0)).Type
func Quote(buf []byte, val string, double bool) []byte {
if len(val) == 0 {
if double {
return append(buf, `"\"\""`...)
}
return append(buf, `""`...)
}
if double {
buf = append(buf, `"\"`...)
} else {
buf = append(buf, `"`...)
}
sp := rt.IndexChar(val, 0)
nb := len(val)
buf = rt.GuardSlice2(buf, nb+1)
b := (*rt.GoSlice)(unsafe.Pointer(&buf))
// input buffer
for nb > 0 {
// output buffer
dp := unsafe.Pointer(uintptr(b.Ptr) + uintptr(b.Len))
dn := b.Cap - b.Len
// call native.Quote, dn is byte count it outputs
opts := uint64(0)
if double {
opts = types.F_DOUBLE_UNQUOTE
}
ret := native.Quote(sp, nb, dp, &dn, opts)
// update *buf length
b.Len += dn
// no need more output
if ret >= 0 {
break
}
// double buf size
*b = rt.GrowSlice(typeByte, *b, b.Cap*2)
// ret is the complement of consumed input
ret = ^ret
// update input buffer
nb -= ret
if nb > 0 {
sp = unsafe.Pointer(uintptr(sp) + uintptr(ret))
}
}
runtime.KeepAlive(buf)
runtime.KeepAlive(sp)
if double {
buf = append(buf, `\""`...)
} else {
buf = append(buf, `"`...)
}
return buf
}
func HtmlEscape(dst []byte, src []byte) []byte {
var sidx int
dst = append(dst, src[:0]...) // avoid check nil dst
sbuf := (*rt.GoSlice)(unsafe.Pointer(&src))
dbuf := (*rt.GoSlice)(unsafe.Pointer(&dst))
/* grow dst if it is shorter */
if cap(dst)-len(dst) < len(src)+types.BufPaddingSize {
cap := len(src)*3/2 + types.BufPaddingSize
*dbuf = rt.GrowSlice(typeByte, *dbuf, cap)
}
for sidx < sbuf.Len {
sp := rt.Add(sbuf.Ptr, uintptr(sidx))
dp := rt.Add(dbuf.Ptr, uintptr(dbuf.Len))
sn := sbuf.Len - sidx
dn := dbuf.Cap - dbuf.Len
nb := native.HTMLEscape(sp, sn, dp, &dn)
/* check for errors */
if dbuf.Len += dn; nb >= 0 {
break
}
/* not enough space, grow the slice and try again */
sidx += ^nb
*dbuf = rt.GrowSlice(typeByte, *dbuf, dbuf.Cap*2)
}
return dst
}
func F64toa(buf []byte, v float64) ([]byte) {
if v == 0 {
return append(buf, '0')
}
buf = rt.GuardSlice2(buf, 64)
ret := native.F64toa((*byte)(rt.IndexByte(buf, len(buf))), v)
if ret > 0 {
return buf[:len(buf)+ret]
} else {
return buf
}
}
func F32toa(buf []byte, v float32) ([]byte) {
if v == 0 {
return append(buf, '0')
}
buf = rt.GuardSlice2(buf, 64)
ret := native.F32toa((*byte)(rt.IndexByte(buf, len(buf))), v)
if ret > 0 {
return buf[:len(buf)+ret]
} else {
return buf
}
}
func I64toa(buf []byte, v int64) ([]byte) {
return strconv.AppendInt(buf, v, 10)
}
func U64toa(buf []byte, v uint64) ([]byte) {
return strconv.AppendUint(buf, v, 10)
}

View File

@@ -0,0 +1,148 @@
// +build !amd64,!arm64 go1.27 !go1.16 arm64,!go1.20
/**
* Copyright 2024 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 alg
import (
_ "unsafe"
"unicode/utf8"
"strconv"
"bytes"
"encoding/json"
"github.com/bytedance/sonic/internal/rt"
)
// Valid validates json and returns first non-blank character position,
// if it is only one valid json value.
// Otherwise returns invalid character position using start.
//
// Note: it does not check for the invalid UTF-8 characters.
func Valid(data []byte) (ok bool, start int) {
ok = json.Valid(data)
return ok, 0
}
var typeByte = rt.UnpackEface(byte(0)).Type
func Quote(e []byte, s string, double bool) []byte {
if len(s) == 0 {
if double {
return append(e, `"\"\""`...)
}
return append(e, `""`...)
}
b := e
ss := len(e)
e = append(e, '"')
start := 0
for i := 0; i < len(s); {
if b := s[i]; b < utf8.RuneSelf {
if rt.SafeSet[b] {
i++
continue
}
if start < i {
e = append(e, s[start:i]...)
}
e = append(e, '\\')
switch b {
case '\\', '"':
e = append(e, b)
case '\n':
e = append(e, 'n')
case '\r':
e = append(e, 'r')
case '\t':
e = append(e, 't')
default:
// This encodes bytes < 0x20 except for \t, \n and \r.
// If escapeHTML is set, it also escapes <, >, and &
// because they can lead to security holes when
// user-controlled strings are rendered into JSON
// and served to some browsers.
e = append(e, `u00`...)
e = append(e, rt.Hex[b>>4])
e = append(e, rt.Hex[b&0xF])
}
i++
start = i
continue
}
c, size := utf8.DecodeRuneInString(s[i:])
// if correct && c == utf8.RuneError && size == 1 {
// if start < i {
// e = append(e, s[start:i]...)
// }
// e = append(e, `\ufffd`...)
// i += size
// start = i
// continue
// }
if c == '\u2028' || c == '\u2029' {
if start < i {
e = append(e, s[start:i]...)
}
e = append(e, `\u202`...)
e = append(e, rt.Hex[c&0xF])
i += size
start = i
continue
}
i += size
}
if start < len(s) {
e = append(e, s[start:]...)
}
e = append(e, '"')
if double {
return strconv.AppendQuote(b, string(e[ss:]))
} else {
return e
}
}
func HtmlEscape(dst []byte, src []byte) []byte {
buf := bytes.NewBuffer(dst)
json.HTMLEscape(buf, src)
return buf.Bytes()
}
func F64toa(buf []byte, v float64) ([]byte) {
bs := bytes.NewBuffer(buf)
_ = json.NewEncoder(bs).Encode(v)
return bs.Bytes()
}
func F32toa(buf []byte, v float32) ([]byte) {
bs := bytes.NewBuffer(buf)
_ = json.NewEncoder(bs).Encode(v)
return bs.Bytes()
}
func I64toa(buf []byte, v int64) ([]byte) {
return strconv.AppendInt(buf, int64(v), 10)
}
func U64toa(buf []byte, v uint64) ([]byte) {
return strconv.AppendUint(buf, v, 10)
}

View File

@@ -0,0 +1,699 @@
/*
* 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 encoder
import (
"reflect"
"unsafe"
"github.com/bytedance/sonic/internal/encoder/ir"
"github.com/bytedance/sonic/internal/encoder/vars"
"github.com/bytedance/sonic/internal/encoder/vm"
"github.com/bytedance/sonic/internal/resolver"
"github.com/bytedance/sonic/internal/rt"
"github.com/bytedance/sonic/option"
)
func ForceUseVM() {
vm.SetCompiler(makeEncoderVM)
pretouchType = pretouchTypeVM
encodeTypedPointer = vm.EncodeTypedPointer
vars.UseVM = true
}
var encodeTypedPointer func(buf *[]byte, vt *rt.GoType, vp *unsafe.Pointer, sb *vars.Stack, fv uint64) error
func makeEncoderVM(vt *rt.GoType, ex ...interface{}) (interface{}, error) {
pp, err := NewCompiler().Compile(vt.Pack(), ex[0].(bool))
if err != nil {
return nil, err
}
return &pp, nil
}
var pretouchType func(_vt reflect.Type, opts option.CompileOptions, v uint8) (map[reflect.Type]uint8, error)
func pretouchTypeVM(_vt reflect.Type, opts option.CompileOptions, v uint8) (map[reflect.Type]uint8, error) {
/* compile function */
compiler := NewCompiler().apply(opts)
encoder := func(vt *rt.GoType, ex ...interface{}) (interface{}, error) {
pp, err := compiler.Compile(vt.Pack(), ex[0].(bool))
if err != nil {
return nil, err
}
return &pp, nil
}
/* find or compile */
vt := rt.UnpackType(_vt)
if val := vars.GetProgram(vt); val != nil {
return nil, nil
} else if _, err := vars.ComputeProgram(vt, encoder, v == 1); err == nil {
return compiler.rec, nil
} else {
return nil, err
}
}
func pretouchRec(vtm map[reflect.Type]uint8, opts option.CompileOptions) error {
if opts.RecursiveDepth < 0 || len(vtm) == 0 {
return nil
}
next := make(map[reflect.Type]uint8)
for vt, v := range vtm {
sub, err := pretouchType(vt, opts, v)
if err != nil {
return err
}
for svt, v := range sub {
next[svt] = v
}
}
opts.RecursiveDepth -= 1
return pretouchRec(next, opts)
}
type Compiler struct {
opts option.CompileOptions
pv bool
tab map[reflect.Type]bool
rec map[reflect.Type]uint8
}
func NewCompiler() *Compiler {
return &Compiler{
opts: option.DefaultCompileOptions(),
tab: map[reflect.Type]bool{},
rec: map[reflect.Type]uint8{},
}
}
func (self *Compiler) apply(opts option.CompileOptions) *Compiler {
self.opts = opts
if self.opts.RecursiveDepth > 0 {
self.rec = map[reflect.Type]uint8{}
}
return self
}
func (self *Compiler) rescue(ep *error) {
if val := recover(); val != nil {
if err, ok := val.(error); ok {
*ep = err
} else {
panic(val)
}
}
}
func (self *Compiler) Compile(vt reflect.Type, pv bool) (ret ir.Program, err error) {
defer self.rescue(&err)
self.compileOne(&ret, 0, vt, pv)
return
}
func (self *Compiler) compileOne(p *ir.Program, sp int, vt reflect.Type, pv bool) {
if self.tab[vt] {
p.Vp(ir.OP_recurse, vt, pv)
} else {
self.compileRec(p, sp, vt, pv)
}
}
func (self *Compiler) tryCompileMarshaler(p *ir.Program, vt reflect.Type, pv bool) bool {
pt := reflect.PtrTo(vt)
/* check for addressable `json.Marshaler` with pointer receiver */
if pv && pt.Implements(vars.JsonMarshalerType) {
addMarshalerOp(p, ir.OP_marshal_p, pt, vars.JsonMarshalerType)
return true
}
/* check for `json.Marshaler` */
if vt.Implements(vars.JsonMarshalerType) {
self.compileMarshaler(p, ir.OP_marshal, vt, vars.JsonMarshalerType)
return true
}
/* check for addressable `encoding.TextMarshaler` with pointer receiver */
if pv && pt.Implements(vars.EncodingTextMarshalerType) {
addMarshalerOp(p, ir.OP_marshal_text_p, pt, vars.EncodingTextMarshalerType)
return true
}
/* check for `encoding.TextMarshaler` */
if vt.Implements(vars.EncodingTextMarshalerType) {
self.compileMarshaler(p, ir.OP_marshal_text, vt, vars.EncodingTextMarshalerType)
return true
}
return false
}
func (self *Compiler) compileRec(p *ir.Program, sp int, vt reflect.Type, pv bool) {
pr := self.pv
if self.tryCompileMarshaler(p, vt, pv) {
return
}
/* enter the recursion, and compile the type */
self.pv = pv
self.tab[vt] = true
self.compileOps(p, sp, vt)
/* exit the recursion */
self.pv = pr
delete(self.tab, vt)
}
func (self *Compiler) compileOps(p *ir.Program, sp int, vt reflect.Type) {
switch vt.Kind() {
case reflect.Bool:
p.Add(ir.OP_bool)
case reflect.Int:
p.Add(ir.OP_int())
case reflect.Int8:
p.Add(ir.OP_i8)
case reflect.Int16:
p.Add(ir.OP_i16)
case reflect.Int32:
p.Add(ir.OP_i32)
case reflect.Int64:
p.Add(ir.OP_i64)
case reflect.Uint:
p.Add(ir.OP_uint())
case reflect.Uint8:
p.Add(ir.OP_u8)
case reflect.Uint16:
p.Add(ir.OP_u16)
case reflect.Uint32:
p.Add(ir.OP_u32)
case reflect.Uint64:
p.Add(ir.OP_u64)
case reflect.Uintptr:
p.Add(ir.OP_uintptr())
case reflect.Float32:
p.Add(ir.OP_f32)
case reflect.Float64:
p.Add(ir.OP_f64)
case reflect.String:
self.compileString(p, vt)
case reflect.Array:
self.compileArray(p, sp, vt.Elem(), vt.Len())
case reflect.Interface:
self.compileInterface(p, vt)
case reflect.Map:
self.compileMap(p, sp, vt)
case reflect.Ptr:
self.compilePtr(p, sp, vt.Elem())
case reflect.Slice:
self.compileSlice(p, sp, vt.Elem())
case reflect.Struct:
self.compileStruct(p, sp, vt)
default:
self.compileUnsupportedType(p, vt)
}
}
func (self *Compiler) compileNil(p *ir.Program, sp int, vt reflect.Type, nil_op ir.Op, fn func(*ir.Program, int, reflect.Type)) {
x := p.PC()
p.Add(ir.OP_is_nil)
fn(p, sp, vt)
e := p.PC()
p.Add(ir.OP_goto)
p.Pin(x)
p.Add(nil_op)
p.Pin(e)
}
func (self *Compiler) compilePtr(p *ir.Program, sp int, vt reflect.Type) {
self.compileNil(p, sp, vt, ir.OP_null, self.compilePtrBody)
}
func (self *Compiler) compilePtrBody(p *ir.Program, sp int, vt reflect.Type) {
p.Tag(sp)
p.Add(ir.OP_save)
p.Add(ir.OP_deref)
self.compileOne(p, sp+1, vt, true)
p.Add(ir.OP_drop)
}
func (self *Compiler) compileMap(p *ir.Program, sp int, vt reflect.Type) {
self.compileNil(p, sp, vt, ir.OP_empty_obj, self.compileMapBody)
}
func (self *Compiler) compileMapBody(p *ir.Program, sp int, vt reflect.Type) {
p.Tag(sp + 1)
p.Int(ir.OP_byte, '{')
e := p.PC()
p.Add(ir.OP_is_zero_map)
p.Add(ir.OP_save)
p.Rtt(ir.OP_map_iter, vt)
p.Add(ir.OP_save)
i := p.PC()
p.Add(ir.OP_map_check_key)
u := p.PC()
p.Add(ir.OP_map_write_key)
self.compileMapBodyKey(p, vt.Key())
p.Pin(u)
p.Int(ir.OP_byte, ':')
p.Add(ir.OP_map_value_next)
self.compileOne(p, sp+2, vt.Elem(), false)
j := p.PC()
p.Add(ir.OP_map_check_key)
p.Int(ir.OP_byte, ',')
v := p.PC()
p.Add(ir.OP_map_write_key)
self.compileMapBodyKey(p, vt.Key())
p.Pin(v)
p.Int(ir.OP_byte, ':')
p.Add(ir.OP_map_value_next)
self.compileOne(p, sp+2, vt.Elem(), false)
p.Int(ir.OP_goto, j)
p.Pin(i)
p.Pin(j)
p.Add(ir.OP_map_stop)
p.Add(ir.OP_drop_2)
p.Pin(e)
p.Int(ir.OP_byte, '}')
}
func (self *Compiler) compileMapBodyKey(p *ir.Program, vk reflect.Type) {
// followed as `encoding/json/emcode.go:resolveKeyName
if vk.Kind() == reflect.String {
self.compileString(p, vk)
return
}
if !vk.Implements(vars.EncodingTextMarshalerType) {
self.compileMapBodyTextKey(p, vk)
} else {
self.compileMapBodyUtextKey(p, vk)
}
}
func (self *Compiler) compileMapBodyTextKey(p *ir.Program, vk reflect.Type) {
switch vk.Kind() {
case reflect.Invalid:
panic("map key is nil")
case reflect.Bool:
p.Key(ir.OP_bool)
case reflect.Int:
p.Key(ir.OP_int())
case reflect.Int8:
p.Key(ir.OP_i8)
case reflect.Int16:
p.Key(ir.OP_i16)
case reflect.Int32:
p.Key(ir.OP_i32)
case reflect.Int64:
p.Key(ir.OP_i64)
case reflect.Uint:
p.Key(ir.OP_uint())
case reflect.Uint8:
p.Key(ir.OP_u8)
case reflect.Uint16:
p.Key(ir.OP_u16)
case reflect.Uint32:
p.Key(ir.OP_u32)
case reflect.Uint64:
p.Key(ir.OP_u64)
case reflect.Uintptr:
p.Key(ir.OP_uintptr())
case reflect.Float32:
p.Key(ir.OP_f32)
case reflect.Float64:
p.Key(ir.OP_f64)
case reflect.String:
self.compileString(p, vk)
default:
panic(vars.Error_type(vk))
}
}
func (self *Compiler) compileMapBodyUtextKey(p *ir.Program, vk reflect.Type) {
if vk.Kind() != reflect.Ptr {
addMarshalerOp(p, ir.OP_marshal_text, vk, vars.EncodingTextMarshalerType)
} else {
self.compileMapBodyUtextPtr(p, vk)
}
}
func (self *Compiler) compileMapBodyUtextPtr(p *ir.Program, vk reflect.Type) {
i := p.PC()
p.Add(ir.OP_is_nil)
addMarshalerOp(p, ir.OP_marshal_text, vk, vars.EncodingTextMarshalerType)
j := p.PC()
p.Add(ir.OP_goto)
p.Pin(i)
p.Str(ir.OP_text, "\"\"")
p.Pin(j)
}
func (self *Compiler) compileSlice(p *ir.Program, sp int, vt reflect.Type) {
self.compileNil(p, sp, vt, ir.OP_empty_arr, self.compileSliceBody)
}
func (self *Compiler) compileSliceBody(p *ir.Program, sp int, vt reflect.Type) {
if vars.IsSimpleByte(vt) {
p.Add(ir.OP_bin)
} else {
self.compileSliceArray(p, sp, vt)
}
}
func (self *Compiler) compileSliceArray(p *ir.Program, sp int, vt reflect.Type) {
p.Tag(sp)
p.Int(ir.OP_byte, '[')
e := p.PC()
p.Add(ir.OP_is_nil)
p.Add(ir.OP_save)
p.Add(ir.OP_slice_len)
i := p.PC()
p.Rtt(ir.OP_slice_next, vt)
self.compileOne(p, sp+1, vt, true)
j := p.PC()
p.Rtt(ir.OP_slice_next, vt)
p.Int(ir.OP_byte, ',')
self.compileOne(p, sp+1, vt, true)
p.Int(ir.OP_goto, j)
p.Pin(i)
p.Pin(j)
p.Add(ir.OP_drop)
p.Pin(e)
p.Int(ir.OP_byte, ']')
}
func (self *Compiler) compileArray(p *ir.Program, sp int, vt reflect.Type, nb int) {
p.Tag(sp)
p.Int(ir.OP_byte, '[')
p.Add(ir.OP_save)
/* first item */
if nb != 0 {
self.compileOne(p, sp+1, vt, self.pv)
p.Add(ir.OP_load)
}
/* remaining items */
for i := 1; i < nb; i++ {
p.Int(ir.OP_byte, ',')
p.Int(ir.OP_index, i*int(vt.Size()))
self.compileOne(p, sp+1, vt, self.pv)
p.Add(ir.OP_load)
}
/* end of array */
p.Add(ir.OP_drop)
p.Int(ir.OP_byte, ']')
}
func (self *Compiler) compileString(p *ir.Program, vt reflect.Type) {
if vt != vars.JsonNumberType {
p.Add(ir.OP_str)
} else {
p.Add(ir.OP_number)
}
}
func (self *Compiler) compileStruct(p *ir.Program, sp int, vt reflect.Type) {
if sp >= self.opts.MaxInlineDepth || p.PC() >= vars.MAX_ILBUF || (sp > 0 && vt.NumField() >= vars.MAX_FIELDS) {
p.Vp(ir.OP_recurse, vt, self.pv)
if self.opts.RecursiveDepth > 0 {
if self.pv {
self.rec[vt] = 1
} else {
self.rec[vt] = 0
}
}
} else {
self.compileStructBody(p, sp, vt)
}
}
func (self *Compiler) compileStructBody(p *ir.Program, sp int, vt reflect.Type) {
p.Tag(sp)
p.Int(ir.OP_byte, '{')
p.Add(ir.OP_save)
p.Add(ir.OP_cond_set)
/* compile each field */
fvs := resolver.ResolveStruct(vt)
for i, fv := range fvs {
var s []int
var o resolver.Offset
/* "omitempty" for arrays */
if fv.Type.Kind() == reflect.Array {
if fv.Type.Len() == 0 && (fv.Opts&resolver.F_omitempty) != 0 {
continue
}
}
/* index to the field */
for _, o = range fv.Path {
if p.Int(ir.OP_index, int(o.Size)); o.Kind == resolver.F_deref {
s = append(s, p.PC())
p.Add(ir.OP_is_nil)
p.Add(ir.OP_deref)
}
}
/* check for "omitempty" option */
if fv.Type.Kind() != reflect.Struct && fv.Type.Kind() != reflect.Array && (fv.Opts&resolver.F_omitempty) != 0 {
s = append(s, p.PC())
self.compileStructFieldEmpty(p, fv.Type)
}
/* check for "omitzero" option */
if fv.Opts&resolver.F_omitzero != 0 {
s = append(s, p.PC())
p.VField(ir.OP_is_zero, &fvs[i])
}
/* add the comma if not the first element */
i := p.PC()
p.Add(ir.OP_cond_testc)
p.Int(ir.OP_byte, ',')
p.Pin(i)
/* compile the key and value */
ft := fv.Type
p.Str(ir.OP_text, Quote(fv.Name)+":")
/* check for "stringnize" option */
if (fv.Opts & resolver.F_stringize) == 0 {
self.compileOne(p, sp+1, ft, self.pv)
} else {
self.compileStructFieldStr(p, sp+1, ft)
}
/* patch the skipping jumps and reload the struct pointer */
p.Rel(s)
p.Add(ir.OP_load)
}
/* end of object */
p.Add(ir.OP_drop)
p.Int(ir.OP_byte, '}')
}
func (self *Compiler) compileStructFieldStr(p *ir.Program, sp int, vt reflect.Type) {
// NOTICE: according to encoding/json, Marshaler type has higher priority than string option
// see issue:
if self.tryCompileMarshaler(p, vt, self.pv) {
return
}
pc := -1
ft := vt
sv := false
/* dereference the pointer if needed */
if ft.Kind() == reflect.Ptr {
ft = ft.Elem()
}
/* check if it can be stringized */
switch ft.Kind() {
case reflect.Bool:
sv = true
case reflect.Int:
sv = true
case reflect.Int8:
sv = true
case reflect.Int16:
sv = true
case reflect.Int32:
sv = true
case reflect.Int64:
sv = true
case reflect.Uint:
sv = true
case reflect.Uint8:
sv = true
case reflect.Uint16:
sv = true
case reflect.Uint32:
sv = true
case reflect.Uint64:
sv = true
case reflect.Uintptr:
sv = true
case reflect.Float32:
sv = true
case reflect.Float64:
sv = true
case reflect.String:
sv = true
}
/* if it's not, ignore the "string" and follow the regular path */
if !sv {
self.compileOne(p, sp, vt, self.pv)
return
}
/* dereference the pointer */
if vt.Kind() == reflect.Ptr {
pc = p.PC()
vt = vt.Elem()
p.Add(ir.OP_is_nil)
p.Add(ir.OP_deref)
}
/* special case of a double-quoted string */
if ft != vars.JsonNumberType && ft.Kind() == reflect.String {
p.Add(ir.OP_quote)
} else {
self.compileStructFieldQuoted(p, sp, vt)
}
/* the "null" case of the pointer */
if pc != -1 {
e := p.PC()
p.Add(ir.OP_goto)
p.Pin(pc)
p.Add(ir.OP_null)
p.Pin(e)
}
}
func (self *Compiler) compileStructFieldEmpty(p *ir.Program, vt reflect.Type) {
switch vt.Kind() {
case reflect.Bool:
p.Add(ir.OP_is_zero_1)
case reflect.Int:
p.Add(ir.OP_is_zero_ints())
case reflect.Int8:
p.Add(ir.OP_is_zero_1)
case reflect.Int16:
p.Add(ir.OP_is_zero_2)
case reflect.Int32:
p.Add(ir.OP_is_zero_4)
case reflect.Int64:
p.Add(ir.OP_is_zero_8)
case reflect.Uint:
p.Add(ir.OP_is_zero_ints())
case reflect.Uint8:
p.Add(ir.OP_is_zero_1)
case reflect.Uint16:
p.Add(ir.OP_is_zero_2)
case reflect.Uint32:
p.Add(ir.OP_is_zero_4)
case reflect.Uint64:
p.Add(ir.OP_is_zero_8)
case reflect.Uintptr:
p.Add(ir.OP_is_nil)
case reflect.Float32:
p.Add(ir.OP_is_zero_4)
case reflect.Float64:
p.Add(ir.OP_is_zero_8)
case reflect.String:
p.Add(ir.OP_is_nil_p1)
case reflect.Interface:
p.Add(ir.OP_is_nil)
case reflect.Map:
p.Add(ir.OP_is_zero_map)
case reflect.Ptr:
p.Add(ir.OP_is_nil)
case reflect.Slice:
p.Add(ir.OP_is_nil_p1)
default:
panic(vars.Error_type(vt))
}
}
func (self *Compiler) compileStructFieldQuoted(p *ir.Program, sp int, vt reflect.Type) {
p.Int(ir.OP_byte, '"')
self.compileOne(p, sp, vt, self.pv)
p.Int(ir.OP_byte, '"')
}
func (self *Compiler) compileInterface(p *ir.Program, vt reflect.Type) {
/* iface and efaces are different */
if vt.NumMethod() == 0 {
p.Add(ir.OP_eface)
return
}
x := p.PC()
p.Add(ir.OP_is_nil_p1)
p.Add(ir.OP_iface)
/* the "null" value */
e := p.PC()
p.Add(ir.OP_goto)
p.Pin(x)
p.Add(ir.OP_null)
p.Pin(e)
}
func (self *Compiler) compileUnsupportedType(p *ir.Program, vt reflect.Type) {
p.Rtt(ir.OP_unsupported, vt)
}
func (self *Compiler) compileMarshaler(p *ir.Program, op ir.Op, vt reflect.Type, mt reflect.Type) {
pc := p.PC()
vk := vt.Kind()
/* direct receiver */
if vk != reflect.Ptr {
addMarshalerOp(p, op, vt, mt)
return
}
/* value receiver with a pointer type, check for nil before calling the marshaler */
p.Add(ir.OP_is_nil)
addMarshalerOp(p, op, vt, mt)
i := p.PC()
p.Add(ir.OP_goto)
p.Pin(pc)
p.Add(ir.OP_null)
p.Pin(i)
}
func addMarshalerOp(p *ir.Program, op ir.Op, vt reflect.Type, mt reflect.Type) {
if vars.UseVM {
itab := rt.GetItab(rt.IfaceType(rt.UnpackType(mt)), rt.UnpackType(vt), true)
p.Vtab(op, vt, itab)
} else {
// OPT: get itab here
p.Rtt(op, vt)
}
}

View File

@@ -0,0 +1,24 @@
//go:build !race
// +build !race
/*
* 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 encoder
func encodeIntoCheckRace(buf *[]byte, val interface{}, opts Options) error {
return encodeInto(buf, val, opts)
}

View File

@@ -0,0 +1,54 @@
//go:build race
// +build race
/*
* 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 encoder
import (
`encoding/json`
`github.com/bytedance/sonic/internal/rt`
)
func helpDetectDataRace(val interface{}) {
var out []byte
defer func() {
if v := recover(); v != nil {
// NOTICE: help user to locate where panic occurs
println("panic when encoding on: ", truncate(out))
panic(v)
}
}()
out, _ = json.Marshal(val)
}
func encodeIntoCheckRace(buf *[]byte, val interface{}, opts Options) error {
err := encodeInto(buf, val, opts)
/* put last to make the panic from sonic will always be caught at first */
helpDetectDataRace(val)
return err
}
func truncate(json []byte) string {
if len(json) <= 256 {
return rt.Mem2Str(json)
} else {
return rt.Mem2Str(json[len(json)-256:])
}
}

View File

@@ -0,0 +1,323 @@
/*
* 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 encoder
import (
"bytes"
"encoding/json"
"reflect"
"runtime"
"github.com/bytedance/sonic/utf8"
"github.com/bytedance/sonic/internal/encoder/alg"
"github.com/bytedance/sonic/internal/encoder/vars"
"github.com/bytedance/sonic/internal/rt"
"github.com/bytedance/sonic/option"
"github.com/bytedance/gopkg/lang/dirtmake"
)
// Options is a set of encoding options.
type Options uint64
const (
// SortMapKeys indicates that the keys of a map needs to be sorted
// before serializing into JSON.
// WARNING: This hurts performance A LOT, USE WITH CARE.
SortMapKeys Options = 1 << alg.BitSortMapKeys
// EscapeHTML indicates encoder to escape all HTML characters
// after serializing into JSON (see https://pkg.go.dev/encoding/json#HTMLEscape).
// WARNING: This hurts performance A LOT, USE WITH CARE.
EscapeHTML Options = 1 << alg.BitEscapeHTML
// CompactMarshaler indicates that the output JSON from json.Marshaler
// is always compact and needs no validation
CompactMarshaler Options = 1 << alg.BitCompactMarshaler
// NoQuoteTextMarshaler indicates that the output text from encoding.TextMarshaler
// is always escaped string and needs no quoting
NoQuoteTextMarshaler Options = 1 << alg.BitNoQuoteTextMarshaler
// NoNullSliceOrMap indicates all empty Array or Object are encoded as '[]' or '{}',
// instead of 'null'.
// NOTE: The priority of this option is lower than json tag `omitempty`.
NoNullSliceOrMap Options = 1 << alg.BitNoNullSliceOrMap
// ValidateString indicates that encoder should validate the input string
// before encoding it into JSON.
ValidateString Options = 1 << alg.BitValidateString
// NoValidateJSONMarshaler indicates that the encoder should not validate the output string
// after encoding the JSONMarshaler to JSON.
NoValidateJSONMarshaler Options = 1 << alg.BitNoValidateJSONMarshaler
// NoEncoderNewline indicates that the encoder should not add a newline after every message
NoEncoderNewline Options = 1 << alg.BitNoEncoderNewline
// CompatibleWithStd is used to be compatible with std encoder.
CompatibleWithStd Options = SortMapKeys | EscapeHTML | CompactMarshaler
// Encode Infinity or Nan float into `null`, instead of returning an error.
EncodeNullForInfOrNan Options = 1 << alg.BitEncodeNullForInfOrNan
)
// Encoder represents a specific set of encoder configurations.
type Encoder struct {
Opts Options
prefix string
indent string
}
// Encode returns the JSON encoding of v.
func (self *Encoder) Encode(v interface{}) ([]byte, error) {
if self.indent != "" || self.prefix != "" {
return EncodeIndented(v, self.prefix, self.indent, self.Opts)
}
return Encode(v, self.Opts)
}
// SortKeys enables the SortMapKeys option.
func (self *Encoder) SortKeys() *Encoder {
self.Opts |= SortMapKeys
return self
}
// SetEscapeHTML specifies if option EscapeHTML opens
func (self *Encoder) SetEscapeHTML(f bool) {
if f {
self.Opts |= EscapeHTML
} else {
self.Opts &= ^EscapeHTML
}
}
// SetValidateString specifies if option ValidateString opens
func (self *Encoder) SetValidateString(f bool) {
if f {
self.Opts |= ValidateString
} else {
self.Opts &= ^ValidateString
}
}
// SetNoValidateJSONMarshaler specifies if option NoValidateJSONMarshaler opens
func (self *Encoder) SetNoValidateJSONMarshaler(f bool) {
if f {
self.Opts |= NoValidateJSONMarshaler
} else {
self.Opts &= ^NoValidateJSONMarshaler
}
}
// SetNoEncoderNewline specifies if option NoEncoderNewline opens
func (self *Encoder) SetNoEncoderNewline(f bool) {
if f {
self.Opts |= NoEncoderNewline
} else {
self.Opts &= ^NoEncoderNewline
}
}
// SetCompactMarshaler specifies if option CompactMarshaler opens
func (self *Encoder) SetCompactMarshaler(f bool) {
if f {
self.Opts |= CompactMarshaler
} else {
self.Opts &= ^CompactMarshaler
}
}
// SetNoQuoteTextMarshaler specifies if option NoQuoteTextMarshaler opens
func (self *Encoder) SetNoQuoteTextMarshaler(f bool) {
if f {
self.Opts |= NoQuoteTextMarshaler
} else {
self.Opts &= ^NoQuoteTextMarshaler
}
}
// SetIndent instructs the encoder to format each subsequent encoded
// value as if indented by the package-level function EncodeIndent().
// Calling SetIndent("", "") disables indentation.
func (enc *Encoder) SetIndent(prefix, indent string) {
enc.prefix = prefix
enc.indent = indent
}
// Quote returns the JSON-quoted version of s.
func Quote(s string) string {
buf := make([]byte, 0, len(s)+2)
buf = alg.Quote(buf, s, false)
return rt.Mem2Str(buf)
}
// Encode returns the JSON encoding of val, encoded with opts.
func Encode(val interface{}, opts Options) ([]byte, error) {
var ret []byte
buf := vars.NewBytes()
err := encodeIntoCheckRace(buf, val, opts)
/* check for errors */
if err != nil {
vars.FreeBytes(buf)
return nil, err
}
/* htmlescape or correct UTF-8 if opts enable */
encodeFinishWithPool(buf, opts)
/* make a copy of the result */
if rt.CanSizeResue(cap(*buf)) {
ret = dirtmake.Bytes(len(*buf), len(*buf))
copy(ret, *buf)
vars.FreeBytes(buf)
} else {
ret = *buf
}
/* return the buffer into pool */
return ret, nil
}
// EncodeInto is like Encode but uses a user-supplied buffer instead of allocating
// a new one.
func EncodeInto(buf *[]byte, val interface{}, opts Options) error {
err := encodeIntoCheckRace(buf, val, opts)
if err != nil {
return err
}
*buf = encodeFinish(*buf, opts)
return err
}
func encodeInto(buf *[]byte, val interface{}, opts Options) error {
stk := vars.NewStack()
efv := rt.UnpackEface(val)
err := encodeTypedPointer(buf, efv.Type, &efv.Value, stk, uint64(opts))
/* return the stack into pool */
if err != nil {
vars.ResetStack(stk)
}
vars.FreeStack(stk)
/* avoid GC ahead */
runtime.KeepAlive(buf)
runtime.KeepAlive(efv)
return err
}
func encodeFinish(buf []byte, opts Options) []byte {
if opts & EscapeHTML != 0 {
buf = HTMLEscape(nil, buf)
}
if (opts & ValidateString != 0) && !utf8.Validate(buf) {
buf = utf8.CorrectWith(nil, buf, `\ufffd`)
}
return buf
}
func encodeFinishWithPool(buf *[]byte, opts Options) {
if opts & EscapeHTML != 0 {
dst := vars.NewBytes()
// put the result bytes to buf and the old buf to dst to return to the pool.
// we cannot return buf to the pool because it will be used by the caller.
*buf, *dst = HTMLEscape(*dst, *buf), *buf
vars.FreeBytes(dst)
}
if (opts & ValidateString != 0) && !utf8.Validate(*buf) {
dst := vars.NewBytes()
*buf, *dst = utf8.CorrectWith(*dst, *buf, `\ufffd`), *buf
vars.FreeBytes(dst)
}
}
// HTMLEscape appends to dst the JSON-encoded src with <, >, &, U+2028 and U+2029
// characters inside string literals changed to \u003c, \u003e, \u0026, \u2028, \u2029
// so that the JSON will be safe to embed inside HTML <script> tags.
// For historical reasons, web browsers don't honor standard HTML
// escaping within <script> tags, so an alternative JSON encoding must
// be used.
func HTMLEscape(dst []byte, src []byte) []byte {
return alg.HtmlEscape(dst, src)
}
// EncodeIndented is like Encode but applies Indent to format the output.
// Each JSON element in the output will begin on a new line beginning with prefix
// followed by one or more copies of indent according to the indentation nesting.
func EncodeIndented(val interface{}, prefix string, indent string, opts Options) ([]byte, error) {
var err error
var buf *bytes.Buffer
/* encode into the buffer */
out := vars.NewBytes()
err = EncodeInto(out, val, opts)
/* check for errors */
if err != nil {
vars.FreeBytes(out)
return nil, err
}
/* indent the JSON */
buf = vars.NewBuffer()
err = json.Indent(buf, *out, prefix, indent)
vars.FreeBytes(out)
/* check for errors */
if err != nil {
vars.FreeBuffer(buf)
return nil, err
}
/* copy to the result buffer */
var ret []byte
if rt.CanSizeResue(cap(buf.Bytes())) {
ret = make([]byte, buf.Len())
copy(ret, buf.Bytes())
/* return the buffers into pool */
vars.FreeBuffer(buf)
} else {
ret = buf.Bytes()
}
return ret, nil
}
// Pretouch compiles vt ahead-of-time to avoid JIT compilation on-the-fly, in
// order to reduce the first-hit latency.
//
// 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.
func Pretouch(vt reflect.Type, opts ...option.CompileOption) error {
cfg := option.DefaultCompileOptions()
for _, opt := range opts {
opt(&cfg)
}
return pretouchRec(map[reflect.Type]uint8{vt: 0}, cfg)
}
// Valid validates json and returns first non-blank character position,
// if it is only one valid json value.
// Otherwise returns invalid character position using start.
//
// Note: it does not check for the invalid UTF-8 characters.
func Valid(data []byte) (ok bool, start int) {
return alg.Valid(data)
}

View File

@@ -0,0 +1,501 @@
/*
* 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 ir
import (
"fmt"
"reflect"
"strconv"
"strings"
"unsafe"
"github.com/bytedance/sonic/internal/encoder/vars"
"github.com/bytedance/sonic/internal/resolver"
"github.com/bytedance/sonic/internal/rt"
)
type Op uint8
const (
OP_null Op = iota + 1
OP_empty_arr
OP_empty_obj
OP_bool
OP_i8
OP_i16
OP_i32
OP_i64
OP_u8
OP_u16
OP_u32
OP_u64
OP_f32
OP_f64
OP_str
OP_bin
OP_quote
OP_number
OP_eface
OP_iface
OP_byte
OP_text
OP_deref
OP_index
OP_load
OP_save
OP_drop
OP_drop_2
OP_recurse
OP_is_nil
OP_is_nil_p1
OP_is_zero_1
OP_is_zero_2
OP_is_zero_4
OP_is_zero_8
OP_is_zero_map
OP_goto
OP_map_iter
OP_map_stop
OP_map_check_key
OP_map_write_key
OP_map_value_next
OP_slice_len
OP_slice_next
OP_marshal
OP_marshal_p
OP_marshal_text
OP_marshal_text_p
OP_cond_set
OP_cond_testc
OP_unsupported
OP_is_zero
)
const (
_INT_SIZE = 32 << (^uint(0) >> 63)
_PTR_SIZE = 32 << (^uintptr(0) >> 63)
_PTR_BYTE = unsafe.Sizeof(uintptr(0))
)
const OpSize = unsafe.Sizeof(NewInsOp(0))
var OpNames = [256]string{
OP_null: "null",
OP_empty_arr: "empty_arr",
OP_empty_obj: "empty_obj",
OP_bool: "bool",
OP_i8: "i8",
OP_i16: "i16",
OP_i32: "i32",
OP_i64: "i64",
OP_u8: "u8",
OP_u16: "u16",
OP_u32: "u32",
OP_u64: "u64",
OP_f32: "f32",
OP_f64: "f64",
OP_str: "str",
OP_bin: "bin",
OP_quote: "quote",
OP_number: "number",
OP_eface: "eface",
OP_iface: "iface",
OP_byte: "byte",
OP_text: "text",
OP_deref: "deref",
OP_index: "index",
OP_load: "load",
OP_save: "save",
OP_drop: "drop",
OP_drop_2: "drop_2",
OP_recurse: "recurse",
OP_is_nil: "is_nil",
OP_is_nil_p1: "is_nil_p1",
OP_is_zero_1: "is_zero_1",
OP_is_zero_2: "is_zero_2",
OP_is_zero_4: "is_zero_4",
OP_is_zero_8: "is_zero_8",
OP_is_zero_map: "is_zero_map",
OP_goto: "goto",
OP_map_iter: "map_iter",
OP_map_stop: "map_stop",
OP_map_check_key: "map_check_key",
OP_map_write_key: "map_write_key",
OP_map_value_next: "map_value_next",
OP_slice_len: "slice_len",
OP_slice_next: "slice_next",
OP_marshal: "marshal",
OP_marshal_p: "marshal_p",
OP_marshal_text: "marshal_text",
OP_marshal_text_p: "marshal_text_p",
OP_cond_set: "cond_set",
OP_cond_testc: "cond_testc",
OP_unsupported: "unsupported type",
}
func (self Op) String() string {
if ret := OpNames[self]; ret != "" {
return ret
} else {
return "<invalid>"
}
}
func OP_int() Op {
switch _INT_SIZE {
case 32:
return OP_i32
case 64:
return OP_i64
default:
panic("unsupported int size")
}
}
func OP_uint() Op {
switch _INT_SIZE {
case 32:
return OP_u32
case 64:
return OP_u64
default:
panic("unsupported uint size")
}
}
func OP_uintptr() Op {
switch _PTR_SIZE {
case 32:
return OP_u32
case 64:
return OP_u64
default:
panic("unsupported pointer size")
}
}
func OP_is_zero_ints() Op {
switch _INT_SIZE {
case 32:
return OP_is_zero_4
case 64:
return OP_is_zero_8
default:
panic("unsupported integer size")
}
}
type Instr struct {
o Op
u int // union {op: 8, _: 8, vi: 48}, vi maybe int or len(str)
p unsafe.Pointer // maybe GoString.Ptr, or *GoType
}
func NewInsOp(op Op) Instr {
return Instr{o: op}
}
func NewInsVi(op Op, vi int) Instr {
return Instr{o: op, u: vi}
}
func NewInsVs(op Op, vs string) Instr {
return Instr{
o: op,
u: len(vs),
p: (*rt.GoString)(unsafe.Pointer(&vs)).Ptr,
}
}
func NewInsVt(op Op, vt reflect.Type) Instr {
return Instr{
o: op,
p: unsafe.Pointer(rt.UnpackType(vt)),
}
}
type typAndTab struct {
vt *rt.GoType
itab *rt.GoItab
}
type typAndField struct {
vt reflect.Type
fv *resolver.FieldMeta
}
func NewInsVtab(op Op, vt reflect.Type, itab *rt.GoItab) Instr {
return Instr{
o: op,
p: unsafe.Pointer(&typAndTab{
vt: rt.UnpackType(vt),
itab: itab,
}),
}
}
func NewInsField(op Op, fv *resolver.FieldMeta) Instr {
return Instr{
o: op,
p: unsafe.Pointer(fv),
}
}
func NewInsVp(op Op, vt reflect.Type, pv bool) Instr {
i := 0
if pv {
i = 1
}
return Instr{
o: op,
u: i,
p: unsafe.Pointer(rt.UnpackType(vt)),
}
}
func (self Instr) Op() Op {
return Op(self.o)
}
func (self Instr) Vi() int {
return self.u
}
func (self Instr) Vf() uint8 {
return (*rt.GoType)(self.p).KindFlags
}
func (self Instr) VField() (*resolver.FieldMeta) {
return (*resolver.FieldMeta)(self.p)
}
func (self Instr) Vs() (v string) {
(*rt.GoString)(unsafe.Pointer(&v)).Ptr = self.p
(*rt.GoString)(unsafe.Pointer(&v)).Len = self.Vi()
return
}
func (self Instr) Vk() reflect.Kind {
return (*rt.GoType)(self.p).Kind()
}
func (self Instr) GoType() *rt.GoType {
return (*rt.GoType)(self.p)
}
func (self Instr) Vt() reflect.Type {
return (*rt.GoType)(self.p).Pack()
}
func (self Instr) Vr() *rt.GoType {
return (*rt.GoType)(self.p)
}
func (self Instr) Vp() (vt reflect.Type, pv bool) {
return (*rt.GoType)(self.p).Pack(), self.u == 1
}
func (self Instr) Vtab() (vt *rt.GoType, itab *rt.GoItab) {
tt := (*typAndTab)(self.p)
return tt.vt, tt.itab
}
func (self Instr) Vp2() (vt *rt.GoType, pv bool) {
return (*rt.GoType)(self.p), self.u == 1
}
func (self Instr) I64() int64 {
return int64(self.Vi())
}
func (self Instr) Byte() byte {
return byte(self.Vi())
}
func (self Instr) Vlen() int {
return int((*rt.GoType)(self.p).Size)
}
func (self Instr) isBranch() bool {
switch self.Op() {
case OP_goto:
fallthrough
case OP_is_nil:
fallthrough
case OP_is_nil_p1:
fallthrough
case OP_is_zero_1:
fallthrough
case OP_is_zero_2:
fallthrough
case OP_is_zero_4:
fallthrough
case OP_is_zero_8:
fallthrough
case OP_map_check_key:
fallthrough
case OP_map_write_key:
fallthrough
case OP_slice_next:
fallthrough
case OP_cond_testc:
return true
default:
return false
}
}
func (self Instr) Disassemble() string {
switch self.Op() {
case OP_byte:
return fmt.Sprintf("%-18s%s", self.Op().String(), strconv.QuoteRune(rune(self.Vi())))
case OP_text:
return fmt.Sprintf("%-18s%s", self.Op().String(), strconv.Quote(self.Vs()))
case OP_index:
return fmt.Sprintf("%-18s%d", self.Op().String(), self.Vi())
case OP_recurse:
fallthrough
case OP_map_iter:
return fmt.Sprintf("%-18s%s", self.Op().String(), self.Vt())
case OP_marshal:
fallthrough
case OP_marshal_p:
fallthrough
case OP_marshal_text:
fallthrough
case OP_marshal_text_p:
vt, _ := self.Vtab()
return fmt.Sprintf("%-18s%s", self.Op().String(), vt.Pack())
case OP_goto:
fallthrough
case OP_is_nil:
fallthrough
case OP_is_nil_p1:
fallthrough
case OP_is_zero_1:
fallthrough
case OP_is_zero_2:
fallthrough
case OP_is_zero_4:
fallthrough
case OP_is_zero_8:
fallthrough
case OP_is_zero_map:
fallthrough
case OP_cond_testc:
fallthrough
case OP_map_check_key:
fallthrough
case OP_map_write_key:
return fmt.Sprintf("%-18sL_%d", self.Op().String(), self.Vi())
case OP_slice_next:
return fmt.Sprintf("%-18sL_%d, %s", self.Op().String(), self.Vi(), self.Vt())
default:
return fmt.Sprintf("%#v", self)
}
}
type (
Program []Instr
)
func (self Program) PC() int {
return len(self)
}
func (self Program) Tag(n int) {
if n >= vars.MaxStack {
panic("type nesting too deep")
}
}
func (self Program) Pin(i int) {
v := &self[i]
v.u = self.PC()
}
func (self Program) Rel(v []int) {
for _, i := range v {
self.Pin(i)
}
}
func (self *Program) Add(op Op) {
*self = append(*self, NewInsOp(op))
}
func (self *Program) Key(op Op) {
*self = append(*self,
NewInsVi(OP_byte, '"'),
NewInsOp(op),
NewInsVi(OP_byte, '"'),
)
}
func (self *Program) Int(op Op, vi int) {
*self = append(*self, NewInsVi(op, vi))
}
func (self *Program) Str(op Op, vs string) {
*self = append(*self, NewInsVs(op, vs))
}
func (self *Program) Rtt(op Op, vt reflect.Type) {
*self = append(*self, NewInsVt(op, vt))
}
func (self *Program) Vp(op Op, vt reflect.Type, pv bool) {
*self = append(*self, NewInsVp(op, vt, pv))
}
func (self *Program) Vtab(op Op, vt reflect.Type, itab *rt.GoItab) {
*self = append(*self, NewInsVtab(op, vt, itab))
}
func (self *Program) VField(op Op, fv *resolver.FieldMeta) {
*self = append(*self, NewInsField(op, fv))
}
func (self Program) Disassemble() string {
nb := len(self)
tab := make([]bool, nb+1)
ret := make([]string, 0, nb+1)
/* prescan to get all the labels */
for _, ins := range self {
if ins.isBranch() {
tab[ins.Vi()] = true
}
}
/* disassemble each instruction */
for i, ins := range self {
if !tab[i] {
ret = append(ret, "\t"+ins.Disassemble())
} else {
ret = append(ret, fmt.Sprintf("L_%d:\n\t%s", i, ins.Disassemble()))
}
}
/* add the last label, if needed */
if tab[nb] {
ret = append(ret, fmt.Sprintf("L_%d:", nb))
}
/* add an "end" indicator, and join all the strings */
return strings.Join(append(ret, "\tend"), "\n")
}

View File

@@ -0,0 +1,85 @@
/*
* 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 encoder
import (
"reflect"
"unsafe"
"github.com/bytedance/sonic/internal/encoder/vars"
"github.com/bytedance/sonic/internal/encoder/x86"
"github.com/bytedance/sonic/internal/rt"
"github.com/bytedance/sonic/option"
)
func ForceUseJit() {
x86.SetCompiler(makeEncoderX86)
pretouchType = pretouchTypeX86
encodeTypedPointer = x86.EncodeTypedPointer
vars.UseVM = false
}
func init() {
if vars.UseVM {
ForceUseVM()
} else {
ForceUseJit()
}
}
var _KeepAlive struct {
rb *[]byte
vp unsafe.Pointer
sb *vars.Stack
fv uint64
err error
frame [x86.FP_offs]byte
}
func makeEncoderX86(vt *rt.GoType, ex ...interface{}) (interface{}, error) {
pp, err := NewCompiler().Compile(vt.Pack(), ex[0].(bool))
if err != nil {
return nil, err
}
as := x86.NewAssembler(pp)
as.Name = vt.String()
return as.Load(), nil
}
func pretouchTypeX86(_vt reflect.Type, opts option.CompileOptions, v uint8) (map[reflect.Type]uint8, error) {
/* compile function */
compiler := NewCompiler().apply(opts)
encoder := func(vt *rt.GoType, ex ...interface{}) (interface{}, error) {
pp, err := compiler.Compile(vt.Pack(), ex[0].(bool))
if err != nil {
return nil, err
}
as := x86.NewAssembler(pp)
as.Name = vt.String()
return as.Load(), nil
}
/* find or compile */
vt := rt.UnpackType(_vt)
if val := vars.GetProgram(vt); val != nil {
return nil, nil
} else if _, err := vars.ComputeProgram(vt, encoder, v == 1); err == nil {
return compiler.rec, nil
} else {
return nil, err
}
}

View File

@@ -0,0 +1,24 @@
//go:build !amd64
// +build !amd64
/*
* 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 encoder
func init() {
ForceUseVM()
}

View File

@@ -0,0 +1,105 @@
/**
* Copyright 2024 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 prim
import (
"encoding"
"encoding/json"
"reflect"
"unsafe"
"github.com/bytedance/sonic/internal/encoder/alg"
"github.com/bytedance/sonic/internal/encoder/vars"
"github.com/bytedance/sonic/internal/resolver"
"github.com/bytedance/sonic/internal/rt"
)
func Compact(p *[]byte, v []byte) error {
buf := vars.NewBuffer()
err := json.Compact(buf, v)
/* check for errors */
if err != nil {
return err
}
/* add to result */
v = buf.Bytes()
*p = append(*p, v...)
/* return the buffer into pool */
vars.FreeBuffer(buf)
return nil
}
func EncodeNil(rb *[]byte) error {
*rb = append(*rb, 'n', 'u', 'l', 'l')
return nil
}
// func Make_EncodeTypedPointer(computor func(*rt.GoType, ...interface{}) (interface{}, error)) func(*[]byte, *rt.GoType, *unsafe.Pointer, *vars.Stack, uint64) error {
// return func(buf *[]byte, vt *rt.GoType, vp *unsafe.Pointer, sb *vars.Stack, fv uint64) error {
// if vt == nil {
// return EncodeNil(buf)
// } else if fn, err := vars.FindOrCompile(vt, (fv&(1<<BitPointerValue)) != 0, computor); err != nil {
// return err
// } else if vt.Indirect() {
// err := fn(buf, *vp, sb, fv)
// return err
// } else {
// err := fn(buf, unsafe.Pointer(vp), sb, fv)
// return err
// }
// }
// }
func EncodeJsonMarshaler(buf *[]byte, val json.Marshaler, opt uint64) error {
if ret, err := val.MarshalJSON(); err != nil {
return err
} else {
if opt&(1<<alg.BitCompactMarshaler) != 0 {
return Compact(buf, ret)
}
if opt&(1<<alg.BitNoValidateJSONMarshaler) == 0 {
if ok, s := alg.Valid(ret); !ok {
return vars.Error_marshaler(ret, s)
}
}
*buf = append(*buf, ret...)
return nil
}
}
func EncodeTextMarshaler(buf *[]byte, val encoding.TextMarshaler, opt uint64) error {
if ret, err := val.MarshalText(); err != nil {
return err
} else {
if opt&(1<<alg.BitNoQuoteTextMarshaler) != 0 {
*buf = append(*buf, ret...)
return nil
}
*buf = alg.Quote(*buf, rt.Mem2Str(ret), false)
return nil
}
}
func IsZero(val unsafe.Pointer, fv *resolver.FieldMeta) bool {
rv := reflect.NewAt(fv.Type, val).Elem()
b1 := fv.IsZero == nil && rv.IsZero()
b2 := fv.IsZero != nil && fv.IsZero(rv)
return b1 || b2
}

View File

@@ -0,0 +1,91 @@
/*
* 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 encoder
import (
"encoding/json"
"io"
"github.com/bytedance/sonic/internal/encoder/vars"
)
// StreamEncoder uses io.Writer as input.
type StreamEncoder struct {
w io.Writer
Encoder
}
// NewStreamEncoder adapts to encoding/json.NewDecoder API.
//
// NewStreamEncoder returns a new encoder that write to w.
func NewStreamEncoder(w io.Writer) *StreamEncoder {
return &StreamEncoder{w: w}
}
// Encode encodes interface{} as JSON to io.Writer
func (enc *StreamEncoder) Encode(val interface{}) (err error) {
out := vars.NewBytes()
/* encode into the buffer */
err = EncodeInto(out, val, enc.Opts)
if err != nil {
goto free_bytes
}
if enc.indent != "" || enc.prefix != "" {
/* indent the JSON */
buf := vars.NewBuffer()
err = json.Indent(buf, *out, enc.prefix, enc.indent)
if err != nil {
vars.FreeBuffer(buf)
goto free_bytes
}
// according to standard library, terminate each value with a newline...
if enc.Opts & NoEncoderNewline == 0 {
buf.WriteByte('\n')
}
/* copy into io.Writer */
_, err = io.Copy(enc.w, buf)
if err != nil {
vars.FreeBuffer(buf)
goto free_bytes
}
} else {
/* copy into io.Writer */
var n int
buf := *out
for len(buf) > 0 {
n, err = enc.w.Write(buf)
buf = buf[n:]
if err != nil {
goto free_bytes
}
}
// according to standard library, terminate each value with a newline...
if enc.Opts & NoEncoderNewline == 0 {
enc.w.Write([]byte{'\n'})
}
}
free_bytes:
vars.FreeBytes(out)
return err
}

View File

@@ -0,0 +1,48 @@
/*
* 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 vars
import (
"unsafe"
"github.com/bytedance/sonic/internal/rt"
)
type Encoder func(
rb *[]byte,
vp unsafe.Pointer,
sb *Stack,
fv uint64,
) error
func FindOrCompile(vt *rt.GoType, pv bool, compiler func(*rt.GoType, ... interface{}) (interface{}, error)) (interface{}, error) {
if val := programCache.Get(vt); val != nil {
return val, nil
} else if ret, err := programCache.Compute(vt, compiler, pv); err == nil {
return ret, nil
} else {
return nil, err
}
}
func GetProgram(vt *rt.GoType) (interface{}) {
return programCache.Get(vt)
}
func ComputeProgram(vt *rt.GoType, compute func(*rt.GoType, ... interface{}) (interface{}, error), pv bool) (interface{}, error) {
return programCache.Compute(vt, compute, pv)
}

View File

@@ -0,0 +1,42 @@
/**
* Copyright 2024 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 vars
import (
"os"
"unsafe"
)
const (
MaxStack = 4096 // 4k states
StackSize = unsafe.Sizeof(Stack{})
StateSize = int64(unsafe.Sizeof(State{}))
StackLimit = MaxStack * StateSize
)
const (
MAX_ILBUF = 100000 // cutoff at 100k of IL instructions
MAX_FIELDS = 50 // cutoff at 50 fields struct
)
var (
DebugSyncGC = os.Getenv("SONIC_SYNC_GC") != ""
DebugAsyncGC = os.Getenv("SONIC_NO_ASYNC_GC") == ""
DebugCheckPtr = os.Getenv("SONIC_CHECK_POINTER") != ""
)
var UseVM = os.Getenv("SONIC_ENCODER_USE_VM") != ""

View File

@@ -0,0 +1,91 @@
/*
* 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 vars
import (
"encoding/json"
"fmt"
"os"
"reflect"
"strconv"
"strings"
"unsafe"
"github.com/bytedance/sonic/internal/rt"
)
var ERR_too_deep = &json.UnsupportedValueError {
Str : "Value nesting too deep",
Value : reflect.ValueOf("..."),
}
var ERR_nan_or_infinite = &json.UnsupportedValueError {
Str : "NaN or ±Infinite",
Value : reflect.ValueOf("NaN or ±Infinite"),
}
func Error_type(vtype reflect.Type) error {
return &json.UnsupportedTypeError{Type: vtype}
}
func Error_number(number json.Number) error {
return &json.UnsupportedValueError {
Str : "invalid number literal: " + strconv.Quote(string(number)),
Value : reflect.ValueOf(number),
}
}
func Error_unsuppoted(typ *rt.GoType) error {
return &json.UnsupportedTypeError{Type: typ.Pack() }
}
func Error_marshaler(ret []byte, pos int) error {
return fmt.Errorf("invalid Marshaler output json syntax at %d: %q", pos, ret)
}
const (
PanicNilPointerOfNonEmptyString int = 1 + iota
)
func GoPanic(code int, val unsafe.Pointer, buf string) {
sb := strings.Builder{}
switch(code){
case PanicNilPointerOfNonEmptyString:
sb.WriteString(fmt.Sprintf("val: %#v has nil pointer while its length is not zero!\nThis is a nil pointer exception (NPE) problem. There might be a data race issue. It is recommended to execute the tests related to the code with the `-race` compile flag to detect the problem.\n", (*rt.GoString)(val)))
default:
sb.WriteString("encoder error: ")
sb.WriteString(strconv.Itoa(code))
sb.WriteString("\n")
}
sb.WriteString("JSON: ")
if len(buf) > maxJSONLength {
sb.WriteString(buf[len(buf)-maxJSONLength:])
} else {
sb.WriteString(buf)
}
panic(sb.String())
}
var maxJSONLength = 1024
func init() {
if v := os.Getenv("SONIC_PANIC_MAX_JSON_LENGTH"); v != "" {
if i, err := strconv.Atoi(v); err == nil {
maxJSONLength = i
}
}
}

View File

@@ -0,0 +1,150 @@
/**
* Copyright 2024 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 vars
import (
"bytes"
"sync"
"unsafe"
"github.com/bytedance/sonic/internal/caching"
"github.com/bytedance/sonic/internal/rt"
"github.com/bytedance/sonic/option"
)
type State struct {
x int
f uint64
p unsafe.Pointer
q unsafe.Pointer
}
type Stack struct {
sp uintptr
sb [MaxStack]State
}
var (
bytesPool = sync.Pool{}
stackPool = sync.Pool{
New: func() interface{} {
return &Stack{}
},
}
bufferPool = sync.Pool{}
programCache = caching.CreateProgramCache()
)
func ResetProgramCache() {
programCache.Reset()
}
func NewBytes() *[]byte {
if ret := bytesPool.Get(); ret != nil {
return ret.(*[]byte)
} else {
ret := make([]byte, 0, option.DefaultEncoderBufferSize)
return &ret
}
}
func NewStack() *Stack {
ret := stackPool.Get().(*Stack)
ret.sp = 0
return ret
}
func ResetStack(p *Stack) {
rt.MemclrNoHeapPointers(unsafe.Pointer(p), StackSize)
}
func (s *Stack) Top() *State {
return (*State)(rt.Add(unsafe.Pointer(&s.sb[0]), s.sp))
}
func (s *Stack) Cur() *State {
return (*State)(rt.Add(unsafe.Pointer(&s.sb[0]), s.sp - uintptr(StateSize)))
}
const _MaxStackSP = uintptr(MaxStack * StateSize)
func (s *Stack) Push(v State) bool {
if uintptr(s.sp) >= _MaxStackSP {
return false
}
st := s.Top()
*st = v
s.sp += uintptr(StateSize)
return true
}
func (s *Stack) Pop() State {
s.sp -= uintptr(StateSize)
st := s.Top()
ret := *st
*st = State{}
return ret
}
func (s *Stack) Load() (int, uint64, unsafe.Pointer, unsafe.Pointer) {
st := s.Cur()
return st.x, st.f, st.p, st.q
}
func (s *Stack) Save(x int, f uint64, p unsafe.Pointer, q unsafe.Pointer) bool {
return s.Push(State{x: x, f:f, p: p, q: q})
}
func (s *Stack) Drop() (int, uint64, unsafe.Pointer, unsafe.Pointer) {
st := s.Pop()
return st.x, st.f, st.p, st.q
}
func NewBuffer() *bytes.Buffer {
if ret := bufferPool.Get(); ret != nil {
return ret.(*bytes.Buffer)
} else {
return bytes.NewBuffer(make([]byte, 0, option.DefaultEncoderBufferSize))
}
}
func FreeBytes(p *[]byte) {
if rt.CanSizeResue(cap(*p)) {
(*p) = (*p)[:0]
bytesPool.Put(p)
}
}
func FreeStack(p *Stack) {
p.sp = 0
stackPool.Put(p)
}
func FreeBuffer(p *bytes.Buffer) {
if rt.CanSizeResue(cap(p.Bytes())) {
p.Reset()
bufferPool.Put(p)
}
}
var (
ArgPtrs = []bool{true, true, true, false}
LocalPtrs = []bool{}
ArgPtrs_generic = []bool{true}
LocalPtrs_generic = []bool{}
)

View File

@@ -0,0 +1,47 @@
/*
* 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 vars
import (
`encoding`
`encoding/json`
`reflect`
)
var (
ByteType = reflect.TypeOf(byte(0))
JsonNumberType = reflect.TypeOf(json.Number(""))
JsonUnsupportedValueType = reflect.TypeOf(new(json.UnsupportedValueError))
)
var (
ErrorType = reflect.TypeOf((*error)(nil)).Elem()
JsonMarshalerType = reflect.TypeOf((*json.Marshaler)(nil)).Elem()
EncodingTextMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem()
)
func IsSimpleByte(vt reflect.Type) bool {
if vt.Kind() != ByteType.Kind() {
return false
} else {
return !isEitherMarshaler(vt) && !isEitherMarshaler(reflect.PtrTo(vt))
}
}
func isEitherMarshaler(vt reflect.Type) bool {
return vt.Implements(JsonMarshalerType) || vt.Implements(EncodingTextMarshalerType)
}

View File

@@ -0,0 +1,46 @@
/**
* Copyright 2024 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 vm
import (
"unsafe"
_ "unsafe"
"github.com/bytedance/sonic/internal/encoder/alg"
"github.com/bytedance/sonic/internal/encoder/ir"
"github.com/bytedance/sonic/internal/encoder/prim"
"github.com/bytedance/sonic/internal/encoder/vars"
"github.com/bytedance/sonic/internal/rt"
)
func EncodeTypedPointer(buf *[]byte, vt *rt.GoType, vp *unsafe.Pointer, sb *vars.Stack, fv uint64) error {
if vt == nil {
return prim.EncodeNil(buf)
} else if pp, err := vars.FindOrCompile(vt, (fv&(1<<alg.BitPointerValue)) != 0, compiler); err != nil {
return err
} else if vt.Indirect() {
return Execute(buf, *vp, sb, fv, pp.(*ir.Program))
} else {
return Execute(buf, unsafe.Pointer(vp), sb, fv, pp.(*ir.Program))
}
}
var compiler func(*rt.GoType, ... interface{}) (interface{}, error)
func SetCompiler(c func(*rt.GoType, ... interface{}) (interface{}, error)) {
compiler = c
}

View File

@@ -0,0 +1,375 @@
// Copyright 2024 CloudWeGo Authors
//
// 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 vm
import (
"encoding"
"encoding/json"
"fmt"
"math"
"reflect"
"unsafe"
"github.com/bytedance/sonic/internal/encoder/alg"
"github.com/bytedance/sonic/internal/encoder/ir"
"github.com/bytedance/sonic/internal/encoder/prim"
"github.com/bytedance/sonic/internal/encoder/vars"
"github.com/bytedance/sonic/internal/rt"
)
const (
_S_cond = iota
_S_init
)
var (
_T_json_Marshaler = rt.UnpackType(vars.JsonMarshalerType)
_T_encoding_TextMarshaler = rt.UnpackType(vars.EncodingTextMarshalerType)
)
func print_instr(buf []byte, pc int, op ir.Op, ins *ir.Instr, p unsafe.Pointer) {
if len(buf) > 20 {
fmt.Println(string(buf[len(buf)-20:]))
} else {
fmt.Println(string(buf))
}
fmt.Printf("pc %04d, op %v, ins %#v, ptr: %x\n", pc, op, ins.Disassemble(), p)
}
func Execute(b *[]byte, p unsafe.Pointer, s *vars.Stack, flags uint64, prog *ir.Program) (error) {
pl := len(*prog)
if pl <= 0 {
return nil
}
var buf = *b
var x int
var q unsafe.Pointer
var f uint64
var pro = &(*prog)[0]
for pc := 0; pc < pl; {
ins := (*ir.Instr)(rt.Add(unsafe.Pointer(pro), ir.OpSize*uintptr(pc)))
pc++
op := ins.Op()
switch op {
case ir.OP_goto:
pc = ins.Vi()
continue
case ir.OP_byte:
v := ins.Byte()
buf = append(buf, v)
case ir.OP_text:
v := ins.Vs()
buf = append(buf, v...)
case ir.OP_deref:
p = *(*unsafe.Pointer)(p)
case ir.OP_index:
p = rt.Add(p, uintptr(ins.I64()))
case ir.OP_load:
// NOTICE: load CANNOT change f!
x, _, p, q = s.Load()
case ir.OP_save:
if !s.Save(x, f, p, q) {
return vars.ERR_too_deep
}
case ir.OP_drop:
x, f, p, q = s.Drop()
case ir.OP_drop_2:
s.Drop()
x, f, p, q = s.Drop()
case ir.OP_recurse:
vt, pv := ins.Vp2()
f := flags
if pv {
f |= (1 << alg.BitPointerValue)
}
*b = buf
if vt.Indirect() {
if err := EncodeTypedPointer(b, vt, (*unsafe.Pointer)(rt.NoEscape(unsafe.Pointer(&p))), s, f); err != nil {
return err
}
} else {
vp := (*unsafe.Pointer)(p)
if err := EncodeTypedPointer(b, vt, vp, s, f); err != nil {
return err
}
}
buf = *b
case ir.OP_is_nil:
if is_nil(p) {
pc = ins.Vi()
continue
}
case ir.OP_is_nil_p1:
if (*rt.GoEface)(p).Value == nil {
pc = ins.Vi()
continue
}
case ir.OP_null:
buf = append(buf, 'n', 'u', 'l', 'l')
case ir.OP_str:
v := *(*string)(p)
buf = alg.Quote(buf, v, false)
case ir.OP_bool:
if *(*bool)(p) {
buf = append(buf, 't', 'r', 'u', 'e')
} else {
buf = append(buf, 'f', 'a', 'l', 's', 'e')
}
case ir.OP_i8:
v := *(*int8)(p)
buf = alg.I64toa(buf, int64(v))
case ir.OP_i16:
v := *(*int16)(p)
buf = alg.I64toa(buf, int64(v))
case ir.OP_i32:
v := *(*int32)(p)
buf = alg.I64toa(buf, int64(v))
case ir.OP_i64:
v := *(*int64)(p)
buf = alg.I64toa(buf, int64(v))
case ir.OP_u8:
v := *(*uint8)(p)
buf = alg.U64toa(buf, uint64(v))
case ir.OP_u16:
v := *(*uint16)(p)
buf = alg.U64toa(buf, uint64(v))
case ir.OP_u32:
v := *(*uint32)(p)
buf = alg.U64toa(buf, uint64(v))
case ir.OP_u64:
v := *(*uint64)(p)
buf = alg.U64toa(buf, uint64(v))
case ir.OP_f32:
v := *(*float32)(p)
if math.IsNaN(float64(v)) || math.IsInf(float64(v), 0) {
if flags&(1<<alg.BitEncodeNullForInfOrNan) != 0 {
buf = append(buf, 'n', 'u', 'l', 'l')
continue
}
return vars.ERR_nan_or_infinite
}
buf = alg.F32toa(buf, v)
case ir.OP_f64:
v := *(*float64)(p)
if math.IsNaN(v) || math.IsInf(v, 0) {
if flags&(1<<alg.BitEncodeNullForInfOrNan) != 0 {
buf = append(buf, 'n', 'u', 'l', 'l')
continue
}
return vars.ERR_nan_or_infinite
}
buf = alg.F64toa(buf, v)
case ir.OP_bin:
v := *(*[]byte)(p)
buf = rt.EncodeBase64(buf, v)
case ir.OP_quote:
v := *(*string)(p)
buf = alg.Quote(buf, v, true)
case ir.OP_number:
v := *(*json.Number)(p)
if v == "" {
buf = append(buf, '0')
} else if !alg.IsValidNumber(string(v)) {
return vars.Error_number(v)
} else {
buf = append(buf, v...)
}
case ir.OP_eface:
*b = buf
if err := EncodeTypedPointer(b, *(**rt.GoType)(p), (*unsafe.Pointer)(rt.Add(p, 8)), s, flags); err != nil {
return err
}
buf = *b
case ir.OP_iface:
*b = buf
if err := EncodeTypedPointer(b, (*(**rt.GoItab)(p)).Vt, (*unsafe.Pointer)(rt.Add(p, 8)), s, flags); err != nil {
return err
}
buf = *b
case ir.OP_is_zero_map:
v := *(*unsafe.Pointer)(p)
if v == nil || rt.Maplen(v) == 0 {
pc = ins.Vi()
continue
}
case ir.OP_map_iter:
v := *(*unsafe.Pointer)(p)
vt := ins.Vr()
it, err := alg.IteratorStart(rt.MapType(vt), v, flags)
if err != nil {
return err
}
q = unsafe.Pointer(it)
case ir.OP_map_stop:
it := (*alg.MapIterator)(q)
alg.IteratorStop(it)
q = nil
case ir.OP_map_value_next:
it := (*alg.MapIterator)(q)
p = it.It.V
alg.IteratorNext(it)
case ir.OP_map_check_key:
it := (*alg.MapIterator)(q)
if it.It.K == nil {
pc = ins.Vi()
continue
}
p = it.It.K
case ir.OP_marshal_text:
vt, itab := ins.Vtab()
var it rt.GoIface
switch vt.Kind() {
case reflect.Interface :
if is_nil(p) {
buf = append(buf, 'n', 'u', 'l', 'l')
continue
}
it = rt.AssertI2I(_T_encoding_TextMarshaler, *(*rt.GoIface)(p))
case reflect.Ptr, reflect.Map : it = convT2I(p, true, itab)
default : it = convT2I(p, !vt.Indirect(), itab)
}
if err := prim.EncodeTextMarshaler(&buf, *(*encoding.TextMarshaler)(unsafe.Pointer(&it)), (flags)); err != nil {
return err
}
case ir.OP_marshal_text_p:
_, itab := ins.Vtab()
it := convT2I(p, false, itab)
if err := prim.EncodeTextMarshaler(&buf, *(*encoding.TextMarshaler)(unsafe.Pointer(&it)), (flags)); err != nil {
return err
}
case ir.OP_map_write_key:
if has_opts(flags, alg.BitSortMapKeys) {
v := *(*string)(p)
buf = alg.Quote(buf, v, false)
pc = ins.Vi()
continue
}
case ir.OP_slice_len:
v := (*rt.GoSlice)(p)
x = v.Len
p = v.Ptr
//TODO: why?
f |= 1<<_S_init
case ir.OP_slice_next:
if x == 0 {
pc = ins.Vi()
continue
}
x--
if has_opts(f, _S_init) {
f &= ^uint64(1 << _S_init)
} else {
p = rt.Add(p, uintptr(ins.Vlen()))
}
case ir.OP_cond_set:
f |= 1<<_S_cond
case ir.OP_cond_testc:
if has_opts(f, _S_cond) {
f &= ^uint64(1 << _S_cond)
pc = ins.Vi()
continue
}
case ir.OP_is_zero:
fv := ins.VField()
if prim.IsZero(p, fv) {
pc = ins.Vi()
continue
}
case ir.OP_is_zero_1:
if *(*uint8)(p) == 0 {
pc = ins.Vi()
continue
}
case ir.OP_is_zero_2:
if *(*uint16)(p) == 0 {
pc = ins.Vi()
continue
}
case ir.OP_is_zero_4:
if *(*uint32)(p) == 0 {
pc = ins.Vi()
continue
}
case ir.OP_is_zero_8:
if *(*uint64)(p) == 0 {
pc = ins.Vi()
continue
}
case ir.OP_empty_arr:
if has_opts(flags, alg.BitNoNullSliceOrMap) {
buf = append(buf, '[', ']')
} else {
buf = append(buf, 'n', 'u', 'l', 'l')
}
case ir.OP_empty_obj:
if has_opts(flags, alg.BitNoNullSliceOrMap) {
buf = append(buf, '{', '}')
} else {
buf = append(buf, 'n', 'u', 'l', 'l')
}
case ir.OP_marshal:
vt, itab := ins.Vtab()
var it rt.GoIface
switch vt.Kind() {
case reflect.Interface :
if is_nil(p) {
buf = append(buf, 'n', 'u', 'l', 'l')
continue
}
it = rt.AssertI2I(_T_json_Marshaler, *(*rt.GoIface)(p))
case reflect.Ptr, reflect.Map : it = convT2I(p, true, itab)
default : it = convT2I(p, !vt.Indirect(), itab)
}
if err := prim.EncodeJsonMarshaler(&buf, *(*json.Marshaler)(unsafe.Pointer(&it)), (flags)); err != nil {
return err
}
case ir.OP_marshal_p:
_, itab := ins.Vtab()
it := convT2I(p, false, itab)
if err := prim.EncodeJsonMarshaler(&buf, *(*json.Marshaler)(unsafe.Pointer(&it)), (flags)); err != nil {
return err
}
case ir.OP_unsupported:
return vars.Error_unsuppoted(ins.GoType())
default:
panic(fmt.Sprintf("not implement %s at %d", ins.Op().String(), pc))
}
}
*b = buf
return nil
}
func has_opts(opts uint64, bit int) bool {
return opts & (1<<bit) != 0
}
func is_nil(p unsafe.Pointer) bool {
return *(*unsafe.Pointer)(p) == nil
}
func convT2I(ptr unsafe.Pointer, deref bool, itab *rt.GoItab) (rt.GoIface) {
if deref {
ptr = *(*unsafe.Pointer)(ptr)
}
return rt.GoIface{
Itab: itab,
Value: ptr,
}
}

View File

@@ -0,0 +1,53 @@
//go:build go1.17 && !go1.21
// +build go1.17,!go1.21
// Copyright 2023 CloudWeGo Authors
//
// 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 x86
import (
"strconv"
"unsafe"
"github.com/bytedance/sonic/internal/jit"
"github.com/bytedance/sonic/internal/rt"
"github.com/twitchyliquid64/golang-asm/obj"
"github.com/twitchyliquid64/golang-asm/obj/x86"
)
var (
_V_writeBarrier = jit.Imm(int64(uintptr(unsafe.Pointer(&rt.RuntimeWriteBarrier))))
_F_gcWriteBarrierAX = jit.Func(rt.GcWriteBarrierAX)
)
func (self *Assembler) WritePtr(i int, ptr obj.Addr, rec obj.Addr) {
if rec.Reg == x86.REG_AX || rec.Index == x86.REG_AX {
panic("rec contains AX!")
}
self.Emit("MOVQ", _V_writeBarrier, _BX)
self.Emit("CMPL", jit.Ptr(_BX, 0), jit.Imm(0))
self.Sjmp("JE", "_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.xsave(_DI)
self.Emit("MOVQ", ptr, _AX)
self.Emit("LEAQ", rec, _DI)
self.Emit("MOVQ", _F_gcWriteBarrierAX, _BX) // MOVQ ${fn}, AX
self.Rjmp("CALL", _BX)
self.xload(_DI)
self.Sjmp("JMP", "_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.Emit("MOVQ", ptr, rec)
self.Link("_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
}

View File

@@ -0,0 +1,52 @@
//go:build go1.21 && !go1.27
// +build go1.21,!go1.27
// Copyright 2023 CloudWeGo Authors
//
// 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 x86
import (
"strconv"
"unsafe"
"github.com/bytedance/sonic/internal/jit"
"github.com/bytedance/sonic/internal/rt"
"github.com/twitchyliquid64/golang-asm/obj"
"github.com/twitchyliquid64/golang-asm/obj/x86"
)
var (
_V_writeBarrier = jit.Imm(int64(uintptr(unsafe.Pointer(&rt.RuntimeWriteBarrier))))
_F_gcWriteBarrier2 = jit.Func(rt.GcWriteBarrier2)
)
func (self *Assembler) WritePtr(i int, ptr obj.Addr, old obj.Addr) {
if old.Reg == x86.REG_AX || old.Index == x86.REG_AX {
panic("rec contains AX!")
}
self.Emit("MOVQ", _V_writeBarrier, _BX)
self.Emit("CMPL", jit.Ptr(_BX, 0), jit.Imm(0))
self.Sjmp("JE", "_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.xsave(_SP_q)
self.Emit("MOVQ", _F_gcWriteBarrier2, _BX) // MOVQ ${fn}, AX
self.Rjmp("CALL", _BX)
self.Emit("MOVQ", ptr, jit.Ptr(_SP_q, 0))
self.Emit("MOVQ", old, _AX)
self.Emit("MOVQ", _AX, jit.Ptr(_SP_q, 8))
self.xload(_SP_q)
self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.Emit("MOVQ", ptr, old)
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,66 @@
// +build go1.17,!go1.17
/*
* 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 x86
import (
`os`
`strings`
`runtime`
`runtime/debug`
`github.com/bytedance/sonic/internal/jit`
)
var (
debugSyncGC = os.Getenv("SONIC_SYNC_GC") != ""
debugAsyncGC = os.Getenv("SONIC_NO_ASYNC_GC") == ""
)
var (
_Instr_End _Instr = newInsOp(_OP_null)
_F_gc = jit.Func(runtime.GC)
_F_force_gc = jit.Func(debug.FreeOSMemory)
_F_println = jit.Func(println_wrapper)
)
func println_wrapper(i int, op1 int, op2 int){
println(i, " Intrs ", op1, _OpNames[op1], "next: ", op2, _OpNames[op2])
}
func (self *_Assembler) force_gc() {
self.call_go(_F_gc)
self.call_go(_F_force_gc)
}
func (self *_Assembler) debug_instr(i int, v *_Instr) {
if debugSyncGC {
if (i+1 == len(self.p)) {
self.print_gc(i, v, &_Instr_End)
} else {
next := &(self.p[i+1])
self.print_gc(i, v, next)
name := _OpNames[next.op()]
if strings.Contains(name, "save") {
return
}
}
self.force_gc()
}
}

View File

@@ -0,0 +1,201 @@
//go:build go1.17 && !go1.27
// +build go1.17,!go1.27
/*
* 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 x86
import (
"fmt"
"runtime"
"strings"
"unsafe"
"github.com/bytedance/sonic/internal/encoder/ir"
"github.com/bytedance/sonic/internal/encoder/vars"
"github.com/bytedance/sonic/internal/jit"
"github.com/twitchyliquid64/golang-asm/obj"
)
const _FP_debug = 128
var (
_Instr_End = ir.NewInsOp(ir.OP_is_nil)
_F_gc = jit.Func(gc)
_F_println = jit.Func(println_wrapper)
_F_print = jit.Func(print)
)
func (self *Assembler) dsave(r ...obj.Addr) {
for i, v := range r {
if i > _FP_debug/8-1 {
panic("too many registers to save")
} else {
self.Emit("MOVQ", v, jit.Ptr(_SP, _FP_fargs+_FP_saves+_FP_locals+int64(i)*8))
}
}
}
func (self *Assembler) dload(r ...obj.Addr) {
for i, v := range r {
if i > _FP_debug/8-1 {
panic("too many registers to load")
} else {
self.Emit("MOVQ", jit.Ptr(_SP, _FP_fargs+_FP_saves+_FP_locals+int64(i)*8), v)
}
}
}
func println_wrapper(i int, op1 int, op2 int) {
println(i, " Intrs ", op1, ir.OpNames[op1], "next: ", op2, ir.OpNames[op2])
}
func print(i int) {
println(i)
}
func gc() {
if !vars.DebugSyncGC {
return
}
runtime.GC()
// debug.FreeOSMemory()
}
func (self *Assembler) dcall(fn obj.Addr) {
self.Emit("MOVQ", fn, _R10) // MOVQ ${fn}, R10
self.Rjmp("CALL", _R10) // CALL R10
}
func (self *Assembler) debug_gc() {
if !vars.DebugSyncGC {
return
}
self.dsave(_REG_debug...)
self.dcall(_F_gc)
self.dload(_REG_debug...)
}
func (self *Assembler) debug_instr(i int, v *ir.Instr) {
if vars.DebugSyncGC {
if i+1 == len(self.p) {
self.print_gc(i, v, &_Instr_End)
} else {
next := &(self.p[i+1])
self.print_gc(i, v, next)
name := ir.OpNames[next.Op()]
if strings.Contains(name, "save") {
return
}
}
// self.debug_gc()
}
}
//go:noescape
//go:linkname checkptrBase runtime.checkptrBase
func checkptrBase(p unsafe.Pointer) uintptr
//go:noescape
//go:linkname findObject runtime.findObject
func findObject(p, refBase, refOff uintptr) (base uintptr, s unsafe.Pointer, objIndex uintptr)
var (
_F_checkptr = jit.Func(checkptr)
_F_printptr = jit.Func(printptr)
)
var (
_R10 = jit.Reg("R10")
)
var _REG_debug = []obj.Addr{
jit.Reg("AX"),
jit.Reg("BX"),
jit.Reg("CX"),
jit.Reg("DX"),
jit.Reg("DI"),
jit.Reg("SI"),
jit.Reg("BP"),
jit.Reg("SP"),
jit.Reg("R8"),
jit.Reg("R9"),
jit.Reg("R10"),
jit.Reg("R11"),
jit.Reg("R12"),
jit.Reg("R13"),
jit.Reg("R14"),
jit.Reg("R15"),
}
func checkptr(ptr uintptr) {
if ptr == 0 {
return
}
fmt.Printf("pointer: %x\n", ptr)
f := checkptrBase(unsafe.Pointer(uintptr(ptr)))
if f == 0 {
fmt.Printf("! unknown-based pointer: %x\n", ptr)
} else if f == 1 {
fmt.Printf("! stack pointer: %x\n", ptr)
} else {
fmt.Printf("base: %x\n", f)
}
findobj(ptr)
}
func findobj(ptr uintptr) {
base, s, objIndex := findObject(ptr, 0, 0)
if s != nil && base == 0 {
fmt.Printf("! invalid pointer: %x\n", ptr)
}
fmt.Printf("objIndex: %d\n", objIndex)
}
func (self *Assembler) check_ptr(ptr obj.Addr, lea bool) {
if !vars.DebugCheckPtr {
return
}
self.dsave(_REG_debug...)
if lea {
self.Emit("LEAQ", ptr, _R10)
} else {
self.Emit("MOVQ", ptr, _R10)
}
self.Emit("MOVQ", _R10, jit.Ptr(_SP, 0))
self.dcall(_F_checkptr)
self.dload(_REG_debug...)
}
func printptr(i int, ptr uintptr) {
fmt.Printf("[%d] ptr: %x\n", i, ptr)
}
func (self *Assembler) print_ptr(i int, ptr obj.Addr, lea bool) {
self.dsave(_REG_debug...)
if lea {
self.Emit("LEAQ", ptr, _R10)
} else {
self.Emit("MOVQ", ptr, _R10)
}
self.Emit("MOVQ", jit.Imm(int64(i)), _AX)
self.Emit("MOVQ", _R10, _BX)
self.dcall(_F_printptr)
self.dload(_REG_debug...)
}

View File

@@ -0,0 +1,52 @@
/**
* Copyright 2024 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 x86
import (
"unsafe"
_ "unsafe"
"github.com/bytedance/sonic/internal/encoder/alg"
"github.com/bytedance/sonic/internal/encoder/prim"
"github.com/bytedance/sonic/internal/encoder/vars"
"github.com/bytedance/sonic/internal/rt"
"github.com/bytedance/sonic/loader"
_ "github.com/cloudwego/base64x"
)
var compiler func(*rt.GoType, ... interface{}) (interface{}, error)
func SetCompiler(c func(*rt.GoType, ... interface{}) (interface{}, error)) {
compiler = c
}
func ptoenc(p loader.Function) vars.Encoder {
return *(*vars.Encoder)(unsafe.Pointer(&p))
}
func EncodeTypedPointer(buf *[]byte, vt *rt.GoType, vp *unsafe.Pointer, sb *vars.Stack, fv uint64) error {
if vt == nil {
return prim.EncodeNil(buf)
} else if fn, err := vars.FindOrCompile(vt, (fv&(1<<alg.BitPointerValue)) != 0, compiler); err != nil {
return err
} else if vt.Indirect() {
return fn.(vars.Encoder)(buf, *vp, sb, fv)
} else {
return fn.(vars.Encoder)(buf, unsafe.Pointer(vp), sb, fv)
}
}

View File

@@ -0,0 +1,24 @@
package envs
import (
"os"
)
var UseOptDec = os.Getenv("SONIC_USE_OPTDEC") == "1"
var UseFastMap = os.Getenv("SONIC_USE_FASTMAP") == "1"
func EnableOptDec() {
UseOptDec = true
}
func DisableOptDec() {
UseOptDec = false
}
func EnableFastMap() {
UseFastMap = true
}
func DisableFastMap() {
UseFastMap = false
}

View File

@@ -0,0 +1,76 @@
/*
* 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 jit
import (
"unsafe"
"github.com/twitchyliquid64/golang-asm/asm/arch"
"github.com/twitchyliquid64/golang-asm/obj"
)
var (
_AC = arch.Set("amd64")
)
func As(op string) obj.As {
if ret, ok := _AC.Instructions[op]; ok {
return ret
} else {
panic("invalid instruction: " + op)
}
}
func ImmPtr(imm unsafe.Pointer) obj.Addr {
return obj.Addr {
Type : obj.TYPE_CONST,
Offset : int64(uintptr(imm)),
}
}
func Imm(imm int64) obj.Addr {
return obj.Addr {
Type : obj.TYPE_CONST,
Offset : imm,
}
}
func Reg(reg string) obj.Addr {
if ret, ok := _AC.Register[reg]; ok {
return obj.Addr{Reg: ret, Type: obj.TYPE_REG}
} else {
panic("invalid register name: " + reg)
}
}
func Ptr(reg obj.Addr, offs int64) obj.Addr {
return obj.Addr {
Reg : reg.Reg,
Type : obj.TYPE_MEM,
Offset : offs,
}
}
func Sib(reg obj.Addr, idx obj.Addr, scale int16, offs int64) obj.Addr {
return obj.Addr {
Reg : reg.Reg,
Index : idx.Reg,
Scale : scale,
Type : obj.TYPE_MEM,
Offset : offs,
}
}

0
vendor/github.com/bytedance/sonic/internal/jit/asm.s generated vendored Normal file
View File

View File

@@ -0,0 +1,270 @@
/*
* 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 jit
import (
`encoding/binary`
`strconv`
`strings`
`sync`
`github.com/bytedance/sonic/loader`
`github.com/bytedance/sonic/internal/rt`
`github.com/twitchyliquid64/golang-asm/obj`
`github.com/twitchyliquid64/golang-asm/obj/x86`
)
const (
_LB_jump_pc = "_jump_pc_"
)
type BaseAssembler struct {
i int
f func()
c []byte
Pcdata loader.Pcdata
o sync.Once
pb *Backend
xrefs map[string][]*obj.Prog
labels map[string]*obj.Prog
pendings map[string][]*obj.Prog
}
/** Instruction Encoders **/
var _NOPS = [][16]byte {
{0x90}, // NOP
{0x66, 0x90}, // 66 NOP
{0x0f, 0x1f, 0x00}, // NOP DWORD ptr [EAX]
{0x0f, 0x1f, 0x40, 0x00}, // NOP DWORD ptr [EAX + 00H]
{0x0f, 0x1f, 0x44, 0x00, 0x00}, // NOP DWORD ptr [EAX + EAX*1 + 00H]
{0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00}, // 66 NOP DWORD ptr [EAX + EAX*1 + 00H]
{0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00}, // NOP DWORD ptr [EAX + 00000000H]
{0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, // NOP DWORD ptr [EAX + EAX*1 + 00000000H]
{0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, // 66 NOP DWORD ptr [EAX + EAX*1 + 00000000H]
}
func (self *BaseAssembler) NOP() *obj.Prog {
p := self.pb.New()
p.As = obj.ANOP
self.pb.Append(p)
return p
}
func (self *BaseAssembler) NOPn(n int) {
for i := len(_NOPS); i > 0 && n > 0; i-- {
for ; n >= i; n -= i {
self.Byte(_NOPS[i - 1][:i]...)
}
}
}
func (self *BaseAssembler) Byte(v ...byte) {
for ; len(v) >= 8; v = v[8:] { self.From("QUAD", Imm(rt.Get64(v))) }
for ; len(v) >= 4; v = v[4:] { self.From("LONG", Imm(int64(rt.Get32(v)))) }
for ; len(v) >= 2; v = v[2:] { self.From("WORD", Imm(int64(rt.Get16(v)))) }
for ; len(v) >= 1; v = v[1:] { self.From("BYTE", Imm(int64(v[0]))) }
}
func (self *BaseAssembler) Mark(pc int) {
self.i++
self.Link(_LB_jump_pc + strconv.Itoa(pc))
}
func (self *BaseAssembler) Link(to string) {
var p *obj.Prog
var v []*obj.Prog
/* placeholder substitution */
if strings.Contains(to, "{n}") {
to = strings.ReplaceAll(to, "{n}", strconv.Itoa(self.i))
}
/* check for duplications */
if _, ok := self.labels[to]; ok {
panic("label " + to + " has already been linked")
}
/* get the pending links */
p = self.NOP()
v = self.pendings[to]
/* patch all the pending jumps */
for _, q := range v {
q.To.Val = p
}
/* mark the label as resolved */
self.labels[to] = p
delete(self.pendings, to)
}
func (self *BaseAssembler) Xref(pc int, d int64) {
self.Sref(_LB_jump_pc + strconv.Itoa(pc), d)
}
func (self *BaseAssembler) Sref(to string, d int64) {
p := self.pb.New()
p.As = x86.ALONG
p.From = Imm(-d)
/* placeholder substitution */
if strings.Contains(to, "{n}") {
to = strings.ReplaceAll(to, "{n}", strconv.Itoa(self.i))
}
/* record the patch point */
self.pb.Append(p)
self.xrefs[to] = append(self.xrefs[to], p)
}
func (self *BaseAssembler) Xjmp(op string, to int) {
self.Sjmp(op, _LB_jump_pc + strconv.Itoa(to))
}
func (self *BaseAssembler) Sjmp(op string, to string) {
p := self.pb.New()
p.As = As(op)
/* placeholder substitution */
if strings.Contains(to, "{n}") {
to = strings.ReplaceAll(to, "{n}", strconv.Itoa(self.i))
}
/* check for backward jumps */
if v, ok := self.labels[to]; ok {
p.To.Val = v
} else {
self.pendings[to] = append(self.pendings[to], p)
}
/* mark as a branch, and add to instruction buffer */
p.To.Type = obj.TYPE_BRANCH
self.pb.Append(p)
}
func (self *BaseAssembler) Rjmp(op string, to obj.Addr) {
p := self.pb.New()
p.To = to
p.As = As(op)
self.pb.Append(p)
}
func (self *BaseAssembler) From(op string, val obj.Addr) {
p := self.pb.New()
p.As = As(op)
p.From = val
self.pb.Append(p)
}
func (self *BaseAssembler) Emit(op string, args ...obj.Addr) {
p := self.pb.New()
p.As = As(op)
self.assignOperands(p, args)
self.pb.Append(p)
}
func (self *BaseAssembler) assignOperands(p *obj.Prog, args []obj.Addr) {
switch len(args) {
case 0 :
case 1 : p.To = args[0]
case 2 : p.To, p.From = args[1], args[0]
case 3 : p.To, p.From, p.RestArgs = args[2], args[0], args[1:2]
case 4 : p.To, p.From, p.RestArgs = args[2], args[3], args[:2]
default : panic("invalid operands")
}
}
/** Assembler Helpers **/
func (self *BaseAssembler) Size() int {
self.build()
return len(self.c)
}
func (self *BaseAssembler) Init(f func()) {
self.i = 0
self.f = f
self.c = nil
self.o = sync.Once{}
}
var jitLoader = loader.Loader{
Name: "sonic.jit.",
File: "github.com/bytedance/sonic/jit.go",
Options: loader.Options{
NoPreempt: true,
},
}
func (self *BaseAssembler) Load(name string, frameSize int, argSize int, argStackmap []bool, localStackmap []bool) loader.Function {
self.build()
return jitLoader.LoadOne(self.c, name, frameSize, argSize, argStackmap, localStackmap, self.Pcdata)
}
/** Assembler Stages **/
func (self *BaseAssembler) init() {
self.pb = newBackend("amd64")
self.xrefs = map[string][]*obj.Prog{}
self.labels = map[string]*obj.Prog{}
self.pendings = map[string][]*obj.Prog{}
}
func (self *BaseAssembler) build() {
self.o.Do(func() {
self.init()
self.f()
self.validate()
self.assemble()
self.resolve()
self.release()
})
}
func (self *BaseAssembler) release() {
self.pb.Release()
self.pb = nil
self.xrefs = nil
self.labels = nil
self.pendings = nil
}
func (self *BaseAssembler) resolve() {
for s, v := range self.xrefs {
for _, prog := range v {
if prog.As != x86.ALONG {
panic("invalid RIP relative reference")
} else if p, ok := self.labels[s]; !ok {
panic("links are not fully resolved: " + s)
} else {
off := prog.From.Offset + p.Pc - prog.Pc
binary.LittleEndian.PutUint32(self.c[prog.Pc:], uint32(off))
}
}
}
}
func (self *BaseAssembler) validate() {
for key := range self.pendings {
panic("links are not fully resolved: " + key)
}
}
func (self *BaseAssembler) assemble() {
self.c, self.Pcdata = self.pb.Assemble()
}

View File

@@ -0,0 +1,219 @@
/*
* 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 jit
import (
`fmt`
`sync`
_ `unsafe`
`github.com/bytedance/sonic/internal/rt`
`github.com/bytedance/sonic/loader`
`github.com/twitchyliquid64/golang-asm/asm/arch`
`github.com/twitchyliquid64/golang-asm/obj`
`github.com/twitchyliquid64/golang-asm/obj/x86`
`github.com/twitchyliquid64/golang-asm/objabi`
)
type Backend struct {
Ctxt *obj.Link
Arch *arch.Arch
Head *obj.Prog
Tail *obj.Prog
Prog []*obj.Prog
}
var (
_progPool sync.Pool
)
func newProg() *obj.Prog {
if val := _progPool.Get(); val == nil {
return new(obj.Prog)
} else {
return remProg(val.(*obj.Prog))
}
}
func remProg(p *obj.Prog) *obj.Prog {
*p = obj.Prog{}
return p
}
func newBackend(name string) (ret *Backend) {
ret = new(Backend)
ret.Arch = arch.Set(name)
ret.Ctxt = newLinkContext(ret.Arch.LinkArch)
ret.Arch.Init(ret.Ctxt)
return
}
func newLinkContext(arch *obj.LinkArch) (ret *obj.Link) {
ret = obj.Linknew(arch)
ret.Headtype = objabi.Hlinux
ret.DiagFunc = diagLinkContext
return
}
func diagLinkContext(str string, args ...interface{}) {
rt.Throw(fmt.Sprintf(str, args...))
}
func (self *Backend) New() (ret *obj.Prog) {
ret = newProg()
ret.Ctxt = self.Ctxt
self.Prog = append(self.Prog, ret)
return
}
func (self *Backend) Append(p *obj.Prog) {
if self.Head == nil {
self.Head = p
self.Tail = p
} else {
self.Tail.Link = p
self.Tail = p
}
}
func (self *Backend) Release() {
self.Arch = nil
self.Ctxt = nil
/* return all the progs into pool */
for _, p := range self.Prog {
_progPool.Put(p)
}
/* clear all the references */
self.Head = nil
self.Tail = nil
self.Prog = nil
}
func (self *Backend) Assemble() ([]byte, loader.Pcdata) {
var sym obj.LSym
var fnv obj.FuncInfo
/* construct the function */
sym.Func = &fnv
fnv.Text = self.Head
/* call the assembler */
self.Arch.Assemble(self.Ctxt, &sym, self.New)
pcdata := self.GetPcspTable(self.Ctxt, &sym, self.New)
return sym.P, pcdata
}
func max(a, b int32) int32 {
if a > b {
return a
}
return b
}
func nextPc(p *obj.Prog) uint32 {
if p.Link != nil && p.Pc + int64(p.Isize) != p.Link.Pc {
panic("p.PC + p.Isize != p.Link.PC")
}
return uint32(p.Pc + int64(p.Isize))
}
// NOTE: copied from https://github.com/twitchyliquid64/golang-asm/blob/8d7f1f783b11f9a00f5bcdfcae17f5ac8f22512e/obj/x86/obj6.go#L811.
// we add two instructions such as subq/addq %rsp, $imm to the table.
func (self *Backend) GetPcspTable(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) loader.Pcdata {
pcdata := loader.Pcdata{}
var deltasp int32
var maxdepth int32
foundRet := false
p := cursym.Func.Text
for ; p != nil; p = p.Link {
if foundRet {
break
}
switch p.As {
default: continue
case x86.APUSHL, x86.APUSHFL:
pcdata = append(pcdata, loader.Pcvalue{PC: nextPc(p), Val: int32(deltasp)})
deltasp += 4
maxdepth = max(maxdepth, deltasp)
continue
case x86.APUSHQ, x86.APUSHFQ:
pcdata = append(pcdata, loader.Pcvalue{PC: nextPc(p), Val: int32(deltasp)})
deltasp += 8
maxdepth = max(maxdepth, deltasp)
continue
case x86.APUSHW, x86.APUSHFW:
pcdata = append(pcdata, loader.Pcvalue{PC: nextPc(p), Val: int32(deltasp)})
deltasp += 2
maxdepth = max(maxdepth, deltasp)
continue
case x86.APOPL, x86.APOPFL:
pcdata = append(pcdata, loader.Pcvalue{PC: nextPc(p), Val: int32(deltasp)})
deltasp -= 4
continue
case x86.APOPQ, x86.APOPFQ:
pcdata = append(pcdata, loader.Pcvalue{PC: nextPc(p), Val: int32(deltasp)})
deltasp -= 8
continue
case x86.APOPW, x86.APOPFW:
pcdata = append(pcdata, loader.Pcvalue{PC: nextPc(p), Val: int32(deltasp)})
deltasp -= 2
continue
case x86.AADJSP:
pcdata = append(pcdata, loader.Pcvalue{PC: nextPc(p), Val: int32(deltasp)})
deltasp += int32(p.From.Offset)
maxdepth = max(maxdepth, deltasp)
continue
case x86.ASUBQ:
// subq %rsp, $imm
if p.To.Reg == x86.REG_SP && p.To.Type == obj.TYPE_REG {
pcdata = append(pcdata, loader.Pcvalue{PC: nextPc(p), Val: int32(deltasp)})
deltasp += int32(p.From.Offset)
maxdepth = max(maxdepth, deltasp)
}
continue
case x86.AADDQ:
// addq %rsp, $imm
if p.To.Reg == x86.REG_SP && p.To.Type == obj.TYPE_REG {
pcdata = append(pcdata, loader.Pcvalue{PC: nextPc(p), Val: int32(deltasp)})
deltasp -= int32(p.From.Offset)
}
continue
case obj.ARET:
if deltasp != 0 {
panic("unbalanced PUSH/POP")
}
pcdata = append(pcdata, loader.Pcvalue{PC: nextPc(p), Val: int32(deltasp)})
foundRet = true
}
}
// the instructions after the RET instruction
if p != nil {
pcdata = append(pcdata, loader.Pcvalue{PC: uint32(cursym.Size), Val: int32(maxdepth)})
}
return pcdata
}

View File

@@ -0,0 +1,49 @@
/*
* 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 jit
import (
`reflect`
`unsafe`
`github.com/bytedance/sonic/internal/rt`
`github.com/twitchyliquid64/golang-asm/obj`
)
func Func(f interface{}) obj.Addr {
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 {
return Gtype(rt.UnpackType(t))
}
func Itab(i *rt.GoType, t reflect.Type) obj.Addr {
return Imm(int64(uintptr(unsafe.Pointer(rt.GetItab(rt.IfaceType(i), rt.UnpackType(t), false)))))
}
func Gitab(i *rt.GoItab) obj.Addr {
return Imm(int64(uintptr(unsafe.Pointer(i))))
}
func Gtype(t *rt.GoType) obj.Addr {
return Imm(int64(uintptr(unsafe.Pointer(t))))
}

View File

@@ -0,0 +1,35 @@
// Code generated by scripts, DO NOT EDIT.
/*
* 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 avx2
import (
`unsafe`
`github.com/bytedance/sonic/internal/rt`
)
var F_f32toa func(out unsafe.Pointer, val float32) (ret int)
var S_f32toa uintptr
//go:nosplit
func f32toa(out *byte, val float32) (ret int) {
return F_f32toa(rt.NoEscape(unsafe.Pointer(out)), val)
}

View File

@@ -0,0 +1,46 @@
// +build !noasm !appengine
// Code generated by asm2asm, DO NOT EDIT.
package avx2
import (
`github.com/bytedance/sonic/loader`
)
const (
_entry__f32toa = 48
)
const (
_stack__f32toa = 64
)
const (
_size__f32toa = 3792
)
var (
_pcsp__f32toa = [][2]uint32{
{0x1, 0},
{0x6, 8},
{0x8, 16},
{0xa, 24},
{0xc, 32},
{0xd, 40},
{0x11, 48},
{0xe9a, 64},
{0xe9b, 48},
{0xe9d, 40},
{0xe9f, 32},
{0xea1, 24},
{0xea3, 16},
{0xea4, 8},
{0xea8, 0},
{0xed0, 64},
}
)
var _cfunc_f32toa = []loader.CFunc{
{"_f32toa_entry", 0, _entry__f32toa, 0, nil},
{"_f32toa", _entry__f32toa, _size__f32toa, _stack__f32toa, _pcsp__f32toa},
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,35 @@
// Code generated by scripts, DO NOT EDIT.
/*
* 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 avx2
import (
`unsafe`
`github.com/bytedance/sonic/internal/rt`
)
var F_f64toa func(out unsafe.Pointer, val float64) (ret int)
var S_f64toa uintptr
//go:nosplit
func f64toa(out *byte, val float64) (ret int) {
return F_f64toa((rt.NoEscape(unsafe.Pointer(out))), val)
}

View File

@@ -0,0 +1,46 @@
// +build !noasm !appengine
// Code generated by asm2asm, DO NOT EDIT.
package avx2
import (
`github.com/bytedance/sonic/loader`
)
const (
_entry__f64toa = 48
)
const (
_stack__f64toa = 72
)
const (
_size__f64toa = 5088
)
var (
_pcsp__f64toa = [][2]uint32{
{0x1, 0},
{0x6, 8},
{0x8, 16},
{0xa, 24},
{0xc, 32},
{0xd, 40},
{0x11, 48},
{0x137d, 72},
{0x137e, 48},
{0x1380, 40},
{0x1382, 32},
{0x1384, 24},
{0x1386, 16},
{0x1387, 8},
{0x138b, 0},
{0x13e0, 72},
}
)
var _cfunc_f64toa = []loader.CFunc{
{"_f64toa_entry", 0, _entry__f64toa, 0, nil},
{"_f64toa", _entry__f64toa, _size__f64toa, _stack__f64toa, _pcsp__f64toa},
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,35 @@
// Code generated by scripts, DO NOT EDIT.
/*
* 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 avx2
import (
`unsafe`
`github.com/bytedance/sonic/internal/native/types`
`github.com/bytedance/sonic/internal/rt`
)
var F_get_by_path func(s unsafe.Pointer, p unsafe.Pointer, path unsafe.Pointer, m unsafe.Pointer) (ret int)
var S_get_by_path uintptr
//go:nosplit
func get_by_path(s *string, p *int, path *[]interface{}, m *types.StateMachine) (ret int) {
return F_get_by_path(rt.NoEscape(unsafe.Pointer(s)), rt.NoEscape(unsafe.Pointer(p)), rt.NoEscape(unsafe.Pointer(path)), rt.NoEscape(unsafe.Pointer(m)))
}

View File

@@ -0,0 +1,48 @@
//go:build !noasm || !appengine
// +build !noasm !appengine
// Code generated by asm2asm, DO NOT EDIT.
package avx2
import (
"github.com/bytedance/sonic/loader"
)
const (
_entry__get_by_path = 640
)
const (
_stack__get_by_path = 240
)
const (
_size__get_by_path = 22088
)
var (
_pcsp__get_by_path = [][2]uint32{
{0x1, 0},
{0x6, 8},
{0x8, 16},
{0xa, 24},
{0xc, 32},
{0xd, 40},
{0x14, 48},
{0x4c1d, 240},
{0x4c1e, 48},
{0x4c20, 40},
{0x4c22, 32},
{0x4c24, 24},
{0x4c26, 16},
{0x4c27, 8},
{0x4c2b, 0},
{0x5648, 240},
}
)
var _cfunc_get_by_path = []loader.CFunc{
{"_get_by_path_entry", 0, _entry__get_by_path, 0, nil},
{"_get_by_path", _entry__get_by_path, _size__get_by_path, _stack__get_by_path, _pcsp__get_by_path},
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,34 @@
// Code generated by scripts, DO NOT EDIT.
/*
* 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 avx2
import (
`unsafe`
`github.com/bytedance/sonic/internal/rt`
)
var F_html_escape func(sp unsafe.Pointer, nb int, dp unsafe.Pointer, dn unsafe.Pointer) (ret int)
var S_html_escape uintptr
//go:nosplit
func html_escape(sp unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int) (ret int) {
return F_html_escape(rt.NoEscape(sp), nb, dp, rt.NoEscape(unsafe.Pointer(dn)))
}

View File

@@ -0,0 +1,45 @@
// +build !noasm !appengine
// Code generated by asm2asm, DO NOT EDIT.
package avx2
import (
`github.com/bytedance/sonic/loader`
)
const (
_entry__html_escape = 192
)
const (
_stack__html_escape = 72
)
const (
_size__html_escape = 2048
)
var (
_pcsp__html_escape = [][2]uint32{
{0x1, 0},
{0x6, 8},
{0x8, 16},
{0xa, 24},
{0xc, 32},
{0xd, 40},
{0x11, 48},
{0x7e5, 72},
{0x7e6, 48},
{0x7e8, 40},
{0x7ea, 32},
{0x7ec, 24},
{0x7ee, 16},
{0x7ef, 8},
{0x800, 0},
}
)
var _cfunc_html_escape = []loader.CFunc{
{"_html_escape_entry", 0, _entry__html_escape, 0, nil},
{"_html_escape", _entry__html_escape, _size__html_escape, _stack__html_escape, _pcsp__html_escape},
}

View File

@@ -0,0 +1,832 @@
// +build amd64
// Code generated by asm2asm, DO NOT EDIT.
package avx2
var _text_html_escape = []byte{
// .p2align 5, 0x00
// LCPI0_0
0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, // QUAD $0x2626262626262626; QUAD $0x2626262626262626 // .space 16, '&&&&&&&&&&&&&&&&'
0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, //0x00000010 QUAD $0x2626262626262626; QUAD $0x2626262626262626 // .space 16, '&&&&&&&&&&&&&&&&'
//0x00000020 LCPI0_1
0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, //0x00000020 QUAD $0xe2e2e2e2e2e2e2e2; QUAD $0xe2e2e2e2e2e2e2e2 // .space 16, '\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2'
0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, //0x00000030 QUAD $0xe2e2e2e2e2e2e2e2; QUAD $0xe2e2e2e2e2e2e2e2 // .space 16, '\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2'
//0x00000040 LCPI0_2
0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, //0x00000040 QUAD $0xfdfdfdfdfdfdfdfd; QUAD $0xfdfdfdfdfdfdfdfd // .space 16, '\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd'
0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, //0x00000050 QUAD $0xfdfdfdfdfdfdfdfd; QUAD $0xfdfdfdfdfdfdfdfd // .space 16, '\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd'
//0x00000060 LCPI0_3
0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, //0x00000060 QUAD $0x3c3c3c3c3c3c3c3c; QUAD $0x3c3c3c3c3c3c3c3c // .space 16, '<<<<<<<<<<<<<<<<'
0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, //0x00000070 QUAD $0x3c3c3c3c3c3c3c3c; QUAD $0x3c3c3c3c3c3c3c3c // .space 16, '<<<<<<<<<<<<<<<<'
//0x00000080 .p2align 4, 0x00
//0x00000080 LCPI0_4
0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, //0x00000080 QUAD $0x2626262626262626; QUAD $0x2626262626262626 // .space 16, '&&&&&&&&&&&&&&&&'
//0x00000090 LCPI0_5
0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, 0xe2, //0x00000090 QUAD $0xe2e2e2e2e2e2e2e2; QUAD $0xe2e2e2e2e2e2e2e2 // .space 16, '\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2\xe2'
//0x000000a0 LCPI0_6
0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, //0x000000a0 QUAD $0xfdfdfdfdfdfdfdfd; QUAD $0xfdfdfdfdfdfdfdfd // .space 16, '\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd'
//0x000000b0 LCPI0_7
0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, //0x000000b0 QUAD $0x3c3c3c3c3c3c3c3c; QUAD $0x3c3c3c3c3c3c3c3c // .space 16, '<<<<<<<<<<<<<<<<'
//0x000000c0 .p2align 4, 0x90
//0x000000c0 _html_escape
0x55, //0x000000c0 pushq %rbp
0x48, 0x89, 0xe5, //0x000000c1 movq %rsp, %rbp
0x41, 0x57, //0x000000c4 pushq %r15
0x41, 0x56, //0x000000c6 pushq %r14
0x41, 0x55, //0x000000c8 pushq %r13
0x41, 0x54, //0x000000ca pushq %r12
0x53, //0x000000cc pushq %rbx
0x48, 0x83, 0xec, 0x18, //0x000000cd subq $24, %rsp
0x48, 0x89, 0x4d, 0xc0, //0x000000d1 movq %rcx, $-64(%rbp)
0x49, 0x89, 0xd7, //0x000000d5 movq %rdx, %r15
0x48, 0x89, 0x55, 0xc8, //0x000000d8 movq %rdx, $-56(%rbp)
0x48, 0x89, 0x7d, 0xd0, //0x000000dc movq %rdi, $-48(%rbp)
0x48, 0x89, 0xf8, //0x000000e0 movq %rdi, %rax
0x48, 0x85, 0xf6, //0x000000e3 testq %rsi, %rsi
0x0f, 0x8e, 0x8c, 0x07, 0x00, 0x00, //0x000000e6 jle LBB0_106
0x48, 0x8b, 0x45, 0xc0, //0x000000ec movq $-64(%rbp), %rax
0x4c, 0x8b, 0x08, //0x000000f0 movq (%rax), %r9
0xc5, 0xfe, 0x6f, 0x1d, 0x05, 0xff, 0xff, 0xff, //0x000000f3 vmovdqu $-251(%rip), %ymm3 /* LCPI0_0+0(%rip) */
0xc5, 0xfe, 0x6f, 0x25, 0x1d, 0xff, 0xff, 0xff, //0x000000fb vmovdqu $-227(%rip), %ymm4 /* LCPI0_1+0(%rip) */
0xc5, 0xfe, 0x6f, 0x2d, 0x35, 0xff, 0xff, 0xff, //0x00000103 vmovdqu $-203(%rip), %ymm5 /* LCPI0_2+0(%rip) */
0xc5, 0xfe, 0x6f, 0x35, 0x4d, 0xff, 0xff, 0xff, //0x0000010b vmovdqu $-179(%rip), %ymm6 /* LCPI0_3+0(%rip) */
0x4c, 0x8d, 0x35, 0xa6, 0x07, 0x00, 0x00, //0x00000113 leaq $1958(%rip), %r14 /* __HtmlQuoteTab+0(%rip) */
0x4c, 0x8b, 0x5d, 0xd0, //0x0000011a movq $-48(%rbp), %r11
0x4c, 0x8b, 0x7d, 0xc8, //0x0000011e movq $-56(%rbp), %r15
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, //0x00000122 .p2align 4, 0x90
//0x00000130 LBB0_2
0x4d, 0x85, 0xc9, //0x00000130 testq %r9, %r9
0x0f, 0x8e, 0x5e, 0x07, 0x00, 0x00, //0x00000133 jle LBB0_3
0x48, 0x83, 0xfe, 0x20, //0x00000139 cmpq $32, %rsi
0x0f, 0x9d, 0xc1, //0x0000013d setge %cl
0x4c, 0x89, 0xc8, //0x00000140 movq %r9, %rax
0x4d, 0x89, 0xf8, //0x00000143 movq %r15, %r8
0x49, 0x89, 0xf2, //0x00000146 movq %rsi, %r10
0x4d, 0x89, 0xdc, //0x00000149 movq %r11, %r12
0x0f, 0x8c, 0x7e, 0x00, 0x00, 0x00, //0x0000014c jl LBB0_12
0x49, 0x83, 0xf9, 0x20, //0x00000152 cmpq $32, %r9
0x0f, 0x8c, 0x74, 0x00, 0x00, 0x00, //0x00000156 jl LBB0_12
0x45, 0x31, 0xc0, //0x0000015c xorl %r8d, %r8d
0x48, 0x89, 0xf3, //0x0000015f movq %rsi, %rbx
0x4c, 0x89, 0xcf, //0x00000162 movq %r9, %rdi
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, //0x00000165 .p2align 4, 0x90
//0x00000170 LBB0_7
0xc4, 0x81, 0x7e, 0x6f, 0x04, 0x03, //0x00000170 vmovdqu (%r11,%r8), %ymm0
0xc5, 0xfd, 0x74, 0xcb, //0x00000176 vpcmpeqb %ymm3, %ymm0, %ymm1
0xc5, 0xfd, 0x74, 0xd4, //0x0000017a vpcmpeqb %ymm4, %ymm0, %ymm2
0xc5, 0xed, 0xeb, 0xc9, //0x0000017e vpor %ymm1, %ymm2, %ymm1
0xc5, 0xfd, 0xdb, 0xd5, //0x00000182 vpand %ymm5, %ymm0, %ymm2
0xc5, 0xed, 0x74, 0xd6, //0x00000186 vpcmpeqb %ymm6, %ymm2, %ymm2
0xc5, 0xf5, 0xeb, 0xca, //0x0000018a vpor %ymm2, %ymm1, %ymm1
0xc4, 0x81, 0x7e, 0x7f, 0x04, 0x07, //0x0000018e vmovdqu %ymm0, (%r15,%r8)
0xc5, 0xfd, 0xd7, 0xc1, //0x00000194 vpmovmskb %ymm1, %eax
0x85, 0xc0, //0x00000198 testl %eax, %eax
0x0f, 0x85, 0x90, 0x01, 0x00, 0x00, //0x0000019a jne LBB0_8
0x4c, 0x8d, 0x53, 0xe0, //0x000001a0 leaq $-32(%rbx), %r10
0x48, 0x8d, 0x47, 0xe0, //0x000001a4 leaq $-32(%rdi), %rax
0x49, 0x83, 0xc0, 0x20, //0x000001a8 addq $32, %r8
0x48, 0x83, 0xfb, 0x40, //0x000001ac cmpq $64, %rbx
0x0f, 0x9d, 0xc1, //0x000001b0 setge %cl
0x0f, 0x8c, 0x10, 0x00, 0x00, 0x00, //0x000001b3 jl LBB0_11
0x4c, 0x89, 0xd3, //0x000001b9 movq %r10, %rbx
0x48, 0x83, 0xff, 0x3f, //0x000001bc cmpq $63, %rdi
0x48, 0x89, 0xc7, //0x000001c0 movq %rax, %rdi
0x0f, 0x8f, 0xa7, 0xff, 0xff, 0xff, //0x000001c3 jg LBB0_7
//0x000001c9 LBB0_11
0x4f, 0x8d, 0x24, 0x03, //0x000001c9 leaq (%r11,%r8), %r12
0x4d, 0x01, 0xf8, //0x000001cd addq %r15, %r8
//0x000001d0 LBB0_12
0x84, 0xc9, //0x000001d0 testb %cl, %cl
0x0f, 0x84, 0x88, 0x00, 0x00, 0x00, //0x000001d2 je LBB0_38
0xc4, 0xc1, 0x7e, 0x6f, 0x04, 0x24, //0x000001d8 vmovdqu (%r12), %ymm0
0xc5, 0xfd, 0x74, 0xcb, //0x000001de vpcmpeqb %ymm3, %ymm0, %ymm1
0xc5, 0xfd, 0x74, 0xd4, //0x000001e2 vpcmpeqb %ymm4, %ymm0, %ymm2
0xc5, 0xed, 0xeb, 0xc9, //0x000001e6 vpor %ymm1, %ymm2, %ymm1
0xc5, 0xfd, 0xdb, 0xc5, //0x000001ea vpand %ymm5, %ymm0, %ymm0
0xc5, 0xfd, 0x74, 0xc6, //0x000001ee vpcmpeqb %ymm6, %ymm0, %ymm0
0xc5, 0xf5, 0xeb, 0xc0, //0x000001f2 vpor %ymm0, %ymm1, %ymm0
0xc5, 0xfd, 0xd7, 0xc8, //0x000001f6 vpmovmskb %ymm0, %ecx
0x48, 0xba, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, //0x000001fa movabsq $4294967296, %rdx
0x48, 0x09, 0xd1, //0x00000204 orq %rdx, %rcx
0x4c, 0x0f, 0xbc, 0xe9, //0x00000207 bsfq %rcx, %r13
0xc4, 0xc1, 0x7a, 0x6f, 0x04, 0x24, //0x0000020b vmovdqu (%r12), %xmm0
0xc4, 0xe3, 0xf9, 0x16, 0xc1, 0x01, //0x00000211 vpextrq $1, %xmm0, %rcx
0xc4, 0xe1, 0xf9, 0x7e, 0xc7, //0x00000217 vmovq %xmm0, %rdi
0x49, 0x39, 0xc5, //0x0000021c cmpq %rax, %r13
0x0f, 0x8e, 0x17, 0x01, 0x00, 0x00, //0x0000021f jle LBB0_14
0x48, 0x83, 0xf8, 0x10, //0x00000225 cmpq $16, %rax
0x0f, 0x82, 0x4a, 0x01, 0x00, 0x00, //0x00000229 jb LBB0_27
0x49, 0x89, 0x38, //0x0000022f movq %rdi, (%r8)
0x49, 0x89, 0x48, 0x08, //0x00000232 movq %rcx, $8(%r8)
0x4d, 0x8d, 0x54, 0x24, 0x10, //0x00000236 leaq $16(%r12), %r10
0x49, 0x83, 0xc0, 0x10, //0x0000023b addq $16, %r8
0x4c, 0x8d, 0x70, 0xf0, //0x0000023f leaq $-16(%rax), %r14
0x49, 0x83, 0xfe, 0x08, //0x00000243 cmpq $8, %r14
0x0f, 0x83, 0x3c, 0x01, 0x00, 0x00, //0x00000247 jae LBB0_30
0xe9, 0x49, 0x01, 0x00, 0x00, //0x0000024d jmp LBB0_31
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, //0x00000252 .p2align 4, 0x90
//0x00000260 LBB0_38
0xc5, 0xf8, 0x77, //0x00000260 vzeroupper
0x49, 0x83, 0xfa, 0x10, //0x00000263 cmpq $16, %r10
0x0f, 0x9d, 0xc1, //0x00000267 setge %cl
0x0f, 0x8c, 0x5f, 0x01, 0x00, 0x00, //0x0000026a jl LBB0_39
0x48, 0x83, 0xf8, 0x10, //0x00000270 cmpq $16, %rax
0xc5, 0xfa, 0x6f, 0x3d, 0x04, 0xfe, 0xff, 0xff, //0x00000274 vmovdqu $-508(%rip), %xmm7 /* LCPI0_4+0(%rip) */
0xc5, 0x7a, 0x6f, 0x05, 0x0c, 0xfe, 0xff, 0xff, //0x0000027c vmovdqu $-500(%rip), %xmm8 /* LCPI0_5+0(%rip) */
0xc5, 0x7a, 0x6f, 0x0d, 0x14, 0xfe, 0xff, 0xff, //0x00000284 vmovdqu $-492(%rip), %xmm9 /* LCPI0_6+0(%rip) */
0xc5, 0x7a, 0x6f, 0x15, 0x1c, 0xfe, 0xff, 0xff, //0x0000028c vmovdqu $-484(%rip), %xmm10 /* LCPI0_7+0(%rip) */
0x0f, 0x8c, 0xeb, 0x01, 0x00, 0x00, //0x00000294 jl LBB0_41
0x4c, 0x89, 0xdf, //0x0000029a movq %r11, %rdi
0x4c, 0x29, 0xe7, //0x0000029d subq %r12, %rdi
0xc5, 0xfe, 0x6f, 0x1d, 0x58, 0xfd, 0xff, 0xff, //0x000002a0 vmovdqu $-680(%rip), %ymm3 /* LCPI0_0+0(%rip) */
0xc5, 0xfe, 0x6f, 0x25, 0x70, 0xfd, 0xff, 0xff, //0x000002a8 vmovdqu $-656(%rip), %ymm4 /* LCPI0_1+0(%rip) */
0xc5, 0xfe, 0x6f, 0x2d, 0x88, 0xfd, 0xff, 0xff, //0x000002b0 vmovdqu $-632(%rip), %ymm5 /* LCPI0_2+0(%rip) */
0xc5, 0xfe, 0x6f, 0x35, 0xa0, 0xfd, 0xff, 0xff, //0x000002b8 vmovdqu $-608(%rip), %ymm6 /* LCPI0_3+0(%rip) */
//0x000002c0 .p2align 4, 0x90
//0x000002c0 LBB0_43
0xc4, 0xc1, 0x7a, 0x6f, 0x04, 0x24, //0x000002c0 vmovdqu (%r12), %xmm0
0xc5, 0xf9, 0x74, 0xcf, //0x000002c6 vpcmpeqb %xmm7, %xmm0, %xmm1
0xc5, 0xb9, 0x74, 0xd0, //0x000002ca vpcmpeqb %xmm0, %xmm8, %xmm2
0xc5, 0xe9, 0xeb, 0xc9, //0x000002ce vpor %xmm1, %xmm2, %xmm1
0xc5, 0xb1, 0xdb, 0xd0, //0x000002d2 vpand %xmm0, %xmm9, %xmm2
0xc5, 0xa9, 0x74, 0xd2, //0x000002d6 vpcmpeqb %xmm2, %xmm10, %xmm2
0xc5, 0xf1, 0xeb, 0xca, //0x000002da vpor %xmm2, %xmm1, %xmm1
0xc4, 0xc1, 0x7a, 0x7f, 0x00, //0x000002de vmovdqu %xmm0, (%r8)
0xc5, 0xf9, 0xd7, 0xc9, //0x000002e3 vpmovmskb %xmm1, %ecx
0x85, 0xc9, //0x000002e7 testl %ecx, %ecx
0x0f, 0x85, 0x7a, 0x00, 0x00, 0x00, //0x000002e9 jne LBB0_44
0x49, 0x83, 0xc4, 0x10, //0x000002ef addq $16, %r12
0x49, 0x83, 0xc0, 0x10, //0x000002f3 addq $16, %r8
0x4d, 0x8d, 0x72, 0xf0, //0x000002f7 leaq $-16(%r10), %r14
0x4c, 0x8d, 0x68, 0xf0, //0x000002fb leaq $-16(%rax), %r13
0x49, 0x83, 0xfa, 0x20, //0x000002ff cmpq $32, %r10
0x0f, 0x9d, 0xc1, //0x00000303 setge %cl
0x0f, 0x8c, 0x09, 0x01, 0x00, 0x00, //0x00000306 jl LBB0_47
0x48, 0x83, 0xc7, 0xf0, //0x0000030c addq $-16, %rdi
0x4d, 0x89, 0xf2, //0x00000310 movq %r14, %r10
0x48, 0x83, 0xf8, 0x1f, //0x00000313 cmpq $31, %rax
0x4c, 0x89, 0xe8, //0x00000317 movq %r13, %rax
0x0f, 0x8f, 0xa0, 0xff, 0xff, 0xff, //0x0000031a jg LBB0_43
0xe9, 0xf0, 0x00, 0x00, 0x00, //0x00000320 jmp LBB0_47
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, //0x00000325 .p2align 4, 0x90
//0x00000330 LBB0_8
0x44, 0x0f, 0xbc, 0xe0, //0x00000330 bsfl %eax, %r12d
0x4d, 0x01, 0xc4, //0x00000334 addq %r8, %r12
0xe9, 0xeb, 0x03, 0x00, 0x00, //0x00000337 jmp LBB0_83
//0x0000033c LBB0_14
0x41, 0x83, 0xfd, 0x10, //0x0000033c cmpl $16, %r13d
0x0f, 0x82, 0xfb, 0x01, 0x00, 0x00, //0x00000340 jb LBB0_15
0x49, 0x89, 0x38, //0x00000346 movq %rdi, (%r8)
0x49, 0x89, 0x48, 0x08, //0x00000349 movq %rcx, $8(%r8)
0x4d, 0x8d, 0x54, 0x24, 0x10, //0x0000034d leaq $16(%r12), %r10
0x49, 0x83, 0xc0, 0x10, //0x00000352 addq $16, %r8
0x49, 0x8d, 0x45, 0xf0, //0x00000356 leaq $-16(%r13), %rax
0x48, 0x83, 0xf8, 0x08, //0x0000035a cmpq $8, %rax
0x0f, 0x83, 0xed, 0x01, 0x00, 0x00, //0x0000035e jae LBB0_18
0xe9, 0xfa, 0x01, 0x00, 0x00, //0x00000364 jmp LBB0_19
//0x00000369 LBB0_44
0x66, 0x0f, 0xbc, 0xc1, //0x00000369 bsfw %cx, %ax
0x44, 0x0f, 0xb7, 0xe0, //0x0000036d movzwl %ax, %r12d
0x49, 0x29, 0xfc, //0x00000371 subq %rdi, %r12
0xe9, 0xa7, 0x03, 0x00, 0x00, //0x00000374 jmp LBB0_82
//0x00000379 LBB0_27
0x4d, 0x89, 0xe2, //0x00000379 movq %r12, %r10
0x49, 0x89, 0xc6, //0x0000037c movq %rax, %r14
0x49, 0x83, 0xfe, 0x08, //0x0000037f cmpq $8, %r14
0x0f, 0x82, 0x12, 0x00, 0x00, 0x00, //0x00000383 jb LBB0_31
//0x00000389 LBB0_30
0x49, 0x8b, 0x0a, //0x00000389 movq (%r10), %rcx
0x49, 0x89, 0x08, //0x0000038c movq %rcx, (%r8)
0x49, 0x83, 0xc2, 0x08, //0x0000038f addq $8, %r10
0x49, 0x83, 0xc0, 0x08, //0x00000393 addq $8, %r8
0x49, 0x83, 0xc6, 0xf8, //0x00000397 addq $-8, %r14
//0x0000039b LBB0_31
0x49, 0x83, 0xfe, 0x04, //0x0000039b cmpq $4, %r14
0x0f, 0x8d, 0xec, 0x01, 0x00, 0x00, //0x0000039f jge LBB0_32
0x49, 0x83, 0xfe, 0x02, //0x000003a5 cmpq $2, %r14
0x0f, 0x83, 0xfe, 0x01, 0x00, 0x00, //0x000003a9 jae LBB0_34
//0x000003af LBB0_35
0x4d, 0x85, 0xf6, //0x000003af testq %r14, %r14
0x0f, 0x84, 0x06, 0x00, 0x00, 0x00, //0x000003b2 je LBB0_37
//0x000003b8 LBB0_36
0x41, 0x8a, 0x0a, //0x000003b8 movb (%r10), %cl
0x41, 0x88, 0x08, //0x000003bb movb %cl, (%r8)
//0x000003be LBB0_37
0x4c, 0x01, 0xe0, //0x000003be addq %r12, %rax
0x48, 0xf7, 0xd0, //0x000003c1 notq %rax
0x4c, 0x01, 0xd8, //0x000003c4 addq %r11, %rax
0x49, 0x89, 0xc4, //0x000003c7 movq %rax, %r12
0xe9, 0x51, 0x03, 0x00, 0x00, //0x000003ca jmp LBB0_82
//0x000003cf LBB0_39
0x49, 0x89, 0xc5, //0x000003cf movq %rax, %r13
0x4d, 0x89, 0xd6, //0x000003d2 movq %r10, %r14
0xc5, 0xfe, 0x6f, 0x1d, 0x23, 0xfc, 0xff, 0xff, //0x000003d5 vmovdqu $-989(%rip), %ymm3 /* LCPI0_0+0(%rip) */
0xc5, 0xfe, 0x6f, 0x25, 0x3b, 0xfc, 0xff, 0xff, //0x000003dd vmovdqu $-965(%rip), %ymm4 /* LCPI0_1+0(%rip) */
0xc5, 0xfe, 0x6f, 0x2d, 0x53, 0xfc, 0xff, 0xff, //0x000003e5 vmovdqu $-941(%rip), %ymm5 /* LCPI0_2+0(%rip) */
0xc5, 0xfe, 0x6f, 0x35, 0x6b, 0xfc, 0xff, 0xff, //0x000003ed vmovdqu $-917(%rip), %ymm6 /* LCPI0_3+0(%rip) */
0xc5, 0xfa, 0x6f, 0x3d, 0x83, 0xfc, 0xff, 0xff, //0x000003f5 vmovdqu $-893(%rip), %xmm7 /* LCPI0_4+0(%rip) */
0xc5, 0x7a, 0x6f, 0x05, 0x8b, 0xfc, 0xff, 0xff, //0x000003fd vmovdqu $-885(%rip), %xmm8 /* LCPI0_5+0(%rip) */
0xc5, 0x7a, 0x6f, 0x0d, 0x93, 0xfc, 0xff, 0xff, //0x00000405 vmovdqu $-877(%rip), %xmm9 /* LCPI0_6+0(%rip) */
0xc5, 0x7a, 0x6f, 0x15, 0x9b, 0xfc, 0xff, 0xff, //0x0000040d vmovdqu $-869(%rip), %xmm10 /* LCPI0_7+0(%rip) */
//0x00000415 LBB0_47
0x84, 0xc9, //0x00000415 testb %cl, %cl
0x0f, 0x84, 0x96, 0x00, 0x00, 0x00, //0x00000417 je LBB0_48
//0x0000041d LBB0_58
0xc4, 0xc1, 0x7a, 0x6f, 0x04, 0x24, //0x0000041d vmovdqu (%r12), %xmm0
0xc5, 0xf9, 0x74, 0xcf, //0x00000423 vpcmpeqb %xmm7, %xmm0, %xmm1
0xc5, 0xb9, 0x74, 0xd0, //0x00000427 vpcmpeqb %xmm0, %xmm8, %xmm2
0xc5, 0xe9, 0xeb, 0xc9, //0x0000042b vpor %xmm1, %xmm2, %xmm1
0xc5, 0xb1, 0xdb, 0xd0, //0x0000042f vpand %xmm0, %xmm9, %xmm2
0xc5, 0xa9, 0x74, 0xd2, //0x00000433 vpcmpeqb %xmm2, %xmm10, %xmm2
0xc5, 0xf1, 0xeb, 0xca, //0x00000437 vpor %xmm2, %xmm1, %xmm1
0xc5, 0xf9, 0xd7, 0xc1, //0x0000043b vpmovmskb %xmm1, %eax
0x0d, 0x00, 0x00, 0x01, 0x00, //0x0000043f orl $65536, %eax
0x0f, 0xbc, 0xc0, //0x00000444 bsfl %eax, %eax
0xc4, 0xe1, 0xf9, 0x7e, 0xc1, //0x00000447 vmovq %xmm0, %rcx
0x49, 0x39, 0xc5, //0x0000044c cmpq %rax, %r13
0x0f, 0x8d, 0xb8, 0x01, 0x00, 0x00, //0x0000044f jge LBB0_59
0x49, 0x83, 0xfd, 0x08, //0x00000455 cmpq $8, %r13
0x4c, 0x8d, 0x35, 0x60, 0x04, 0x00, 0x00, //0x00000459 leaq $1120(%rip), %r14 /* __HtmlQuoteTab+0(%rip) */
0x0f, 0x82, 0xe1, 0x01, 0x00, 0x00, //0x00000460 jb LBB0_70
0x49, 0x89, 0x08, //0x00000466 movq %rcx, (%r8)
0x49, 0x8d, 0x44, 0x24, 0x08, //0x00000469 leaq $8(%r12), %rax
0x49, 0x83, 0xc0, 0x08, //0x0000046e addq $8, %r8
0x49, 0x8d, 0x7d, 0xf8, //0x00000472 leaq $-8(%r13), %rdi
0x48, 0x83, 0xff, 0x04, //0x00000476 cmpq $4, %rdi
0x0f, 0x8d, 0xd7, 0x01, 0x00, 0x00, //0x0000047a jge LBB0_73
0xe9, 0xe3, 0x01, 0x00, 0x00, //0x00000480 jmp LBB0_74
//0x00000485 LBB0_41
0x49, 0x89, 0xc5, //0x00000485 movq %rax, %r13
0x4d, 0x89, 0xd6, //0x00000488 movq %r10, %r14
0xc5, 0xfe, 0x6f, 0x1d, 0x6d, 0xfb, 0xff, 0xff, //0x0000048b vmovdqu $-1171(%rip), %ymm3 /* LCPI0_0+0(%rip) */
0xc5, 0xfe, 0x6f, 0x25, 0x85, 0xfb, 0xff, 0xff, //0x00000493 vmovdqu $-1147(%rip), %ymm4 /* LCPI0_1+0(%rip) */
0xc5, 0xfe, 0x6f, 0x2d, 0x9d, 0xfb, 0xff, 0xff, //0x0000049b vmovdqu $-1123(%rip), %ymm5 /* LCPI0_2+0(%rip) */
0xc5, 0xfe, 0x6f, 0x35, 0xb5, 0xfb, 0xff, 0xff, //0x000004a3 vmovdqu $-1099(%rip), %ymm6 /* LCPI0_3+0(%rip) */
0x84, 0xc9, //0x000004ab testb %cl, %cl
0x0f, 0x85, 0x6a, 0xff, 0xff, 0xff, //0x000004ad jne LBB0_58
//0x000004b3 LBB0_48
0x4d, 0x85, 0xf6, //0x000004b3 testq %r14, %r14
0x0f, 0x8e, 0x71, 0x00, 0x00, 0x00, //0x000004b6 jle LBB0_56
0x4d, 0x85, 0xed, //0x000004bc testq %r13, %r13
0x0f, 0x8e, 0x68, 0x00, 0x00, 0x00, //0x000004bf jle LBB0_56
0x31, 0xc9, //0x000004c5 xorl %ecx, %ecx
0x31, 0xc0, //0x000004c7 xorl %eax, %eax
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, //0x000004c9 .p2align 4, 0x90
//0x000004d0 LBB0_51
0x41, 0x0f, 0xb6, 0x3c, 0x0c, //0x000004d0 movzbl (%r12,%rcx), %edi
0x48, 0x83, 0xff, 0x3e, //0x000004d5 cmpq $62, %rdi
0x0f, 0x87, 0x14, 0x00, 0x00, 0x00, //0x000004d9 ja LBB0_52
0x48, 0xba, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x50, //0x000004df movabsq $5764607797912141824, %rdx
0x48, 0x0f, 0xa3, 0xfa, //0x000004e9 btq %rdi, %rdx
0x0f, 0x82, 0x49, 0x01, 0x00, 0x00, //0x000004ed jb LBB0_80
//0x000004f3 LBB0_52
0x40, 0x80, 0xff, 0xe2, //0x000004f3 cmpb $-30, %dil
0x0f, 0x84, 0x3f, 0x01, 0x00, 0x00, //0x000004f7 je LBB0_80
0x49, 0x8d, 0x14, 0x06, //0x000004fd leaq (%r14,%rax), %rdx
0x41, 0x88, 0x3c, 0x08, //0x00000501 movb %dil, (%r8,%rcx)
0x48, 0x8d, 0x78, 0xff, //0x00000505 leaq $-1(%rax), %rdi
0x48, 0x83, 0xfa, 0x02, //0x00000509 cmpq $2, %rdx
0x0f, 0x8c, 0x14, 0x00, 0x00, 0x00, //0x0000050d jl LBB0_55
0x4c, 0x01, 0xe8, //0x00000513 addq %r13, %rax
0x48, 0x83, 0xc1, 0x01, //0x00000516 addq $1, %rcx
0x48, 0x83, 0xf8, 0x01, //0x0000051a cmpq $1, %rax
0x48, 0x89, 0xf8, //0x0000051e movq %rdi, %rax
0x0f, 0x8f, 0xa9, 0xff, 0xff, 0xff, //0x00000521 jg LBB0_51
//0x00000527 LBB0_55
0x49, 0x29, 0xfc, //0x00000527 subq %rdi, %r12
0x49, 0x01, 0xfe, //0x0000052a addq %rdi, %r14
//0x0000052d LBB0_56
0x4d, 0x85, 0xf6, //0x0000052d testq %r14, %r14
0x0f, 0x84, 0xe4, 0x01, 0x00, 0x00, //0x00000530 je LBB0_57
0x49, 0xf7, 0xd4, //0x00000536 notq %r12
0x4d, 0x01, 0xdc, //0x00000539 addq %r11, %r12
0xe9, 0xdf, 0x01, 0x00, 0x00, //0x0000053c jmp LBB0_82
//0x00000541 LBB0_15
0x4d, 0x89, 0xe2, //0x00000541 movq %r12, %r10
0x4c, 0x89, 0xe8, //0x00000544 movq %r13, %rax
0x48, 0x83, 0xf8, 0x08, //0x00000547 cmpq $8, %rax
0x0f, 0x82, 0x12, 0x00, 0x00, 0x00, //0x0000054b jb LBB0_19
//0x00000551 LBB0_18
0x49, 0x8b, 0x0a, //0x00000551 movq (%r10), %rcx
0x49, 0x89, 0x08, //0x00000554 movq %rcx, (%r8)
0x49, 0x83, 0xc2, 0x08, //0x00000557 addq $8, %r10
0x49, 0x83, 0xc0, 0x08, //0x0000055b addq $8, %r8
0x48, 0x83, 0xc0, 0xf8, //0x0000055f addq $-8, %rax
//0x00000563 LBB0_19
0x48, 0x83, 0xf8, 0x04, //0x00000563 cmpq $4, %rax
0x0f, 0x8d, 0x62, 0x00, 0x00, 0x00, //0x00000567 jge LBB0_20
0x48, 0x83, 0xf8, 0x02, //0x0000056d cmpq $2, %rax
0x0f, 0x83, 0x74, 0x00, 0x00, 0x00, //0x00000571 jae LBB0_22
//0x00000577 LBB0_23
0x48, 0x85, 0xc0, //0x00000577 testq %rax, %rax
0x0f, 0x84, 0x06, 0x00, 0x00, 0x00, //0x0000057a je LBB0_25
//0x00000580 LBB0_24
0x41, 0x8a, 0x02, //0x00000580 movb (%r10), %al
0x41, 0x88, 0x00, //0x00000583 movb %al, (%r8)
//0x00000586 LBB0_25
0x4d, 0x29, 0xdc, //0x00000586 subq %r11, %r12
0x4d, 0x01, 0xec, //0x00000589 addq %r13, %r12
0xe9, 0x96, 0x01, 0x00, 0x00, //0x0000058c jmp LBB0_83
//0x00000591 LBB0_32
0x41, 0x8b, 0x0a, //0x00000591 movl (%r10), %ecx
0x41, 0x89, 0x08, //0x00000594 movl %ecx, (%r8)
0x49, 0x83, 0xc2, 0x04, //0x00000597 addq $4, %r10
0x49, 0x83, 0xc0, 0x04, //0x0000059b addq $4, %r8
0x49, 0x83, 0xc6, 0xfc, //0x0000059f addq $-4, %r14
0x49, 0x83, 0xfe, 0x02, //0x000005a3 cmpq $2, %r14
0x0f, 0x82, 0x02, 0xfe, 0xff, 0xff, //0x000005a7 jb LBB0_35
//0x000005ad LBB0_34
0x41, 0x0f, 0xb7, 0x0a, //0x000005ad movzwl (%r10), %ecx
0x66, 0x41, 0x89, 0x08, //0x000005b1 movw %cx, (%r8)
0x49, 0x83, 0xc2, 0x02, //0x000005b5 addq $2, %r10
0x49, 0x83, 0xc0, 0x02, //0x000005b9 addq $2, %r8
0x49, 0x83, 0xc6, 0xfe, //0x000005bd addq $-2, %r14
0x4d, 0x85, 0xf6, //0x000005c1 testq %r14, %r14
0x0f, 0x85, 0xee, 0xfd, 0xff, 0xff, //0x000005c4 jne LBB0_36
0xe9, 0xef, 0xfd, 0xff, 0xff, //0x000005ca jmp LBB0_37
//0x000005cf LBB0_20
0x41, 0x8b, 0x0a, //0x000005cf movl (%r10), %ecx
0x41, 0x89, 0x08, //0x000005d2 movl %ecx, (%r8)
0x49, 0x83, 0xc2, 0x04, //0x000005d5 addq $4, %r10
0x49, 0x83, 0xc0, 0x04, //0x000005d9 addq $4, %r8
0x48, 0x83, 0xc0, 0xfc, //0x000005dd addq $-4, %rax
0x48, 0x83, 0xf8, 0x02, //0x000005e1 cmpq $2, %rax
0x0f, 0x82, 0x8c, 0xff, 0xff, 0xff, //0x000005e5 jb LBB0_23
//0x000005eb LBB0_22
0x41, 0x0f, 0xb7, 0x0a, //0x000005eb movzwl (%r10), %ecx
0x66, 0x41, 0x89, 0x08, //0x000005ef movw %cx, (%r8)
0x49, 0x83, 0xc2, 0x02, //0x000005f3 addq $2, %r10
0x49, 0x83, 0xc0, 0x02, //0x000005f7 addq $2, %r8
0x48, 0x83, 0xc0, 0xfe, //0x000005fb addq $-2, %rax
0x48, 0x85, 0xc0, //0x000005ff testq %rax, %rax
0x0f, 0x85, 0x78, 0xff, 0xff, 0xff, //0x00000602 jne LBB0_24
0xe9, 0x79, 0xff, 0xff, 0xff, //0x00000608 jmp LBB0_25
//0x0000060d LBB0_59
0x83, 0xf8, 0x08, //0x0000060d cmpl $8, %eax
0x4c, 0x8d, 0x35, 0xa9, 0x02, 0x00, 0x00, //0x00000610 leaq $681(%rip), %r14 /* __HtmlQuoteTab+0(%rip) */
0x0f, 0x82, 0x74, 0x00, 0x00, 0x00, //0x00000617 jb LBB0_60
0x49, 0x89, 0x08, //0x0000061d movq %rcx, (%r8)
0x4d, 0x8d, 0x54, 0x24, 0x08, //0x00000620 leaq $8(%r12), %r10
0x49, 0x83, 0xc0, 0x08, //0x00000625 addq $8, %r8
0x48, 0x8d, 0x78, 0xf8, //0x00000629 leaq $-8(%rax), %rdi
0x48, 0x83, 0xff, 0x04, //0x0000062d cmpq $4, %rdi
0x0f, 0x8d, 0x6a, 0x00, 0x00, 0x00, //0x00000631 jge LBB0_63
0xe9, 0x77, 0x00, 0x00, 0x00, //0x00000637 jmp LBB0_64
//0x0000063c LBB0_80
0x4d, 0x29, 0xdc, //0x0000063c subq %r11, %r12
0x49, 0x29, 0xc4, //0x0000063f subq %rax, %r12
0xe9, 0xd9, 0x00, 0x00, 0x00, //0x00000642 jmp LBB0_82
//0x00000647 LBB0_70
0x4c, 0x89, 0xe0, //0x00000647 movq %r12, %rax
0x4c, 0x89, 0xef, //0x0000064a movq %r13, %rdi
0x48, 0x83, 0xff, 0x04, //0x0000064d cmpq $4, %rdi
0x0f, 0x8c, 0x11, 0x00, 0x00, 0x00, //0x00000651 jl LBB0_74
//0x00000657 LBB0_73
0x8b, 0x08, //0x00000657 movl (%rax), %ecx
0x41, 0x89, 0x08, //0x00000659 movl %ecx, (%r8)
0x48, 0x83, 0xc0, 0x04, //0x0000065c addq $4, %rax
0x49, 0x83, 0xc0, 0x04, //0x00000660 addq $4, %r8
0x48, 0x83, 0xc7, 0xfc, //0x00000664 addq $-4, %rdi
//0x00000668 LBB0_74
0x48, 0x83, 0xff, 0x02, //0x00000668 cmpq $2, %rdi
0x0f, 0x83, 0x65, 0x00, 0x00, 0x00, //0x0000066c jae LBB0_75
0x48, 0x85, 0xff, //0x00000672 testq %rdi, %rdi
0x0f, 0x84, 0x05, 0x00, 0x00, 0x00, //0x00000675 je LBB0_78
//0x0000067b LBB0_77
0x8a, 0x00, //0x0000067b movb (%rax), %al
0x41, 0x88, 0x00, //0x0000067d movb %al, (%r8)
//0x00000680 LBB0_78
0x4d, 0x01, 0xe5, //0x00000680 addq %r12, %r13
0x49, 0xf7, 0xd5, //0x00000683 notq %r13
0x4d, 0x01, 0xdd, //0x00000686 addq %r11, %r13
0x4d, 0x89, 0xec, //0x00000689 movq %r13, %r12
0xe9, 0x96, 0x00, 0x00, 0x00, //0x0000068c jmp LBB0_83
//0x00000691 LBB0_60
0x4d, 0x89, 0xe2, //0x00000691 movq %r12, %r10
0x48, 0x89, 0xc7, //0x00000694 movq %rax, %rdi
0x48, 0x83, 0xff, 0x04, //0x00000697 cmpq $4, %rdi
0x0f, 0x8c, 0x12, 0x00, 0x00, 0x00, //0x0000069b jl LBB0_64
//0x000006a1 LBB0_63
0x41, 0x8b, 0x0a, //0x000006a1 movl (%r10), %ecx
0x41, 0x89, 0x08, //0x000006a4 movl %ecx, (%r8)
0x49, 0x83, 0xc2, 0x04, //0x000006a7 addq $4, %r10
0x49, 0x83, 0xc0, 0x04, //0x000006ab addq $4, %r8
0x48, 0x83, 0xc7, 0xfc, //0x000006af addq $-4, %rdi
//0x000006b3 LBB0_64
0x48, 0x83, 0xff, 0x02, //0x000006b3 cmpq $2, %rdi
0x0f, 0x83, 0x3b, 0x00, 0x00, 0x00, //0x000006b7 jae LBB0_65
0x48, 0x85, 0xff, //0x000006bd testq %rdi, %rdi
0x0f, 0x84, 0x06, 0x00, 0x00, 0x00, //0x000006c0 je LBB0_68
//0x000006c6 LBB0_67
0x41, 0x8a, 0x0a, //0x000006c6 movb (%r10), %cl
0x41, 0x88, 0x08, //0x000006c9 movb %cl, (%r8)
//0x000006cc LBB0_68
0x4d, 0x29, 0xdc, //0x000006cc subq %r11, %r12
0x49, 0x01, 0xc4, //0x000006cf addq %rax, %r12
0xe9, 0x50, 0x00, 0x00, 0x00, //0x000006d2 jmp LBB0_83
//0x000006d7 LBB0_75
0x0f, 0xb7, 0x08, //0x000006d7 movzwl (%rax), %ecx
0x66, 0x41, 0x89, 0x08, //0x000006da movw %cx, (%r8)
0x48, 0x83, 0xc0, 0x02, //0x000006de addq $2, %rax
0x49, 0x83, 0xc0, 0x02, //0x000006e2 addq $2, %r8
0x48, 0x83, 0xc7, 0xfe, //0x000006e6 addq $-2, %rdi
0x48, 0x85, 0xff, //0x000006ea testq %rdi, %rdi
0x0f, 0x85, 0x88, 0xff, 0xff, 0xff, //0x000006ed jne LBB0_77
0xe9, 0x88, 0xff, 0xff, 0xff, //0x000006f3 jmp LBB0_78
//0x000006f8 LBB0_65
0x41, 0x0f, 0xb7, 0x0a, //0x000006f8 movzwl (%r10), %ecx
0x66, 0x41, 0x89, 0x08, //0x000006fc movw %cx, (%r8)
0x49, 0x83, 0xc2, 0x02, //0x00000700 addq $2, %r10
0x49, 0x83, 0xc0, 0x02, //0x00000704 addq $2, %r8
0x48, 0x83, 0xc7, 0xfe, //0x00000708 addq $-2, %rdi
0x48, 0x85, 0xff, //0x0000070c testq %rdi, %rdi
0x0f, 0x85, 0xb1, 0xff, 0xff, 0xff, //0x0000070f jne LBB0_67
0xe9, 0xb2, 0xff, 0xff, 0xff, //0x00000715 jmp LBB0_68
//0x0000071a LBB0_57
0x4d, 0x29, 0xdc, //0x0000071a subq %r11, %r12
0x90, 0x90, 0x90, //0x0000071d .p2align 4, 0x90
//0x00000720 LBB0_82
0x4c, 0x8d, 0x35, 0x99, 0x01, 0x00, 0x00, //0x00000720 leaq $409(%rip), %r14 /* __HtmlQuoteTab+0(%rip) */
//0x00000727 LBB0_83
0x4d, 0x85, 0xe4, //0x00000727 testq %r12, %r12
0x0f, 0x88, 0x22, 0x01, 0x00, 0x00, //0x0000072a js LBB0_84
0x4d, 0x01, 0xe3, //0x00000730 addq %r12, %r11
0x4d, 0x01, 0xe7, //0x00000733 addq %r12, %r15
0x4c, 0x29, 0xe6, //0x00000736 subq %r12, %rsi
0x0f, 0x8e, 0x36, 0x01, 0x00, 0x00, //0x00000739 jle LBB0_86
0x4d, 0x29, 0xe1, //0x0000073f subq %r12, %r9
0x41, 0x8a, 0x0b, //0x00000742 movb (%r11), %cl
0x80, 0xf9, 0xe2, //0x00000745 cmpb $-30, %cl
0x0f, 0x84, 0xb5, 0x00, 0x00, 0x00, //0x00000748 je LBB0_89
0x4c, 0x89, 0xd8, //0x0000074e movq %r11, %rax
//0x00000751 LBB0_93
0x0f, 0xb6, 0xf9, //0x00000751 movzbl %cl, %edi
0x48, 0xc1, 0xe7, 0x04, //0x00000754 shlq $4, %rdi
0x4a, 0x8b, 0x14, 0x37, //0x00000758 movq (%rdi,%r14), %rdx
0x48, 0x63, 0xda, //0x0000075c movslq %edx, %rbx
0x49, 0x29, 0xd9, //0x0000075f subq %rbx, %r9
0x0f, 0x8c, 0x24, 0x01, 0x00, 0x00, //0x00000762 jl LBB0_94
0x48, 0xc1, 0xe2, 0x20, //0x00000768 shlq $32, %rdx
0x4e, 0x8d, 0x04, 0x37, //0x0000076c leaq (%rdi,%r14), %r8
0x49, 0x83, 0xc0, 0x08, //0x00000770 addq $8, %r8
0x48, 0xb9, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, //0x00000774 movabsq $12884901889, %rcx
0x48, 0x39, 0xca, //0x0000077e cmpq %rcx, %rdx
0x0f, 0x8c, 0x29, 0x00, 0x00, 0x00, //0x00000781 jl LBB0_98
0x41, 0x8b, 0x08, //0x00000787 movl (%r8), %ecx
0x41, 0x89, 0x0f, //0x0000078a movl %ecx, (%r15)
0x4e, 0x8d, 0x04, 0x37, //0x0000078d leaq (%rdi,%r14), %r8
0x49, 0x83, 0xc0, 0x0c, //0x00000791 addq $12, %r8
0x4d, 0x8d, 0x57, 0x04, //0x00000795 leaq $4(%r15), %r10
0x48, 0x8d, 0x7b, 0xfc, //0x00000799 leaq $-4(%rbx), %rdi
0x48, 0x83, 0xff, 0x02, //0x0000079d cmpq $2, %rdi
0x0f, 0x83, 0x19, 0x00, 0x00, 0x00, //0x000007a1 jae LBB0_101
0xe9, 0x28, 0x00, 0x00, 0x00, //0x000007a7 jmp LBB0_102
0x90, 0x90, 0x90, 0x90, //0x000007ac .p2align 4, 0x90
//0x000007b0 LBB0_98
0x4d, 0x89, 0xfa, //0x000007b0 movq %r15, %r10
0x48, 0x89, 0xdf, //0x000007b3 movq %rbx, %rdi
0x48, 0x83, 0xff, 0x02, //0x000007b6 cmpq $2, %rdi
0x0f, 0x82, 0x14, 0x00, 0x00, 0x00, //0x000007ba jb LBB0_102
//0x000007c0 LBB0_101
0x41, 0x0f, 0xb7, 0x10, //0x000007c0 movzwl (%r8), %edx
0x66, 0x41, 0x89, 0x12, //0x000007c4 movw %dx, (%r10)
0x49, 0x83, 0xc0, 0x02, //0x000007c8 addq $2, %r8
0x49, 0x83, 0xc2, 0x02, //0x000007cc addq $2, %r10
0x48, 0x83, 0xc7, 0xfe, //0x000007d0 addq $-2, %rdi
//0x000007d4 LBB0_102
0x48, 0x85, 0xff, //0x000007d4 testq %rdi, %rdi
0x0f, 0x84, 0x06, 0x00, 0x00, 0x00, //0x000007d7 je LBB0_104
0x41, 0x8a, 0x08, //0x000007dd movb (%r8), %cl
0x41, 0x88, 0x0a, //0x000007e0 movb %cl, (%r10)
//0x000007e3 LBB0_104
0x49, 0x01, 0xdf, //0x000007e3 addq %rbx, %r15
//0x000007e6 LBB0_105
0x48, 0x83, 0xc0, 0x01, //0x000007e6 addq $1, %rax
0x48, 0x8d, 0x4e, 0xff, //0x000007ea leaq $-1(%rsi), %rcx
0x49, 0x89, 0xc3, //0x000007ee movq %rax, %r11
0x48, 0x83, 0xfe, 0x01, //0x000007f1 cmpq $1, %rsi
0x48, 0x89, 0xce, //0x000007f5 movq %rcx, %rsi
0x0f, 0x8f, 0x32, 0xf9, 0xff, 0xff, //0x000007f8 jg LBB0_2
0xe9, 0x75, 0x00, 0x00, 0x00, //0x000007fe jmp LBB0_106
//0x00000803 LBB0_89
0x48, 0x83, 0xfe, 0x03, //0x00000803 cmpq $3, %rsi
0x0f, 0x8c, 0x28, 0x00, 0x00, 0x00, //0x00000807 jl LBB0_95
0x41, 0x80, 0x7b, 0x01, 0x80, //0x0000080d cmpb $-128, $1(%r11)
0x0f, 0x85, 0x1d, 0x00, 0x00, 0x00, //0x00000812 jne LBB0_95
0x41, 0x8a, 0x4b, 0x02, //0x00000818 movb $2(%r11), %cl
0x89, 0xc8, //0x0000081c movl %ecx, %eax
0x24, 0xfe, //0x0000081e andb $-2, %al
0x3c, 0xa8, //0x00000820 cmpb $-88, %al
0x0f, 0x85, 0x0d, 0x00, 0x00, 0x00, //0x00000822 jne LBB0_95
0x49, 0x8d, 0x43, 0x02, //0x00000828 leaq $2(%r11), %rax
0x48, 0x83, 0xc6, 0xfe, //0x0000082c addq $-2, %rsi
0xe9, 0x1c, 0xff, 0xff, 0xff, //0x00000830 jmp LBB0_93
//0x00000835 LBB0_95
0x4d, 0x85, 0xc9, //0x00000835 testq %r9, %r9
0x0f, 0x8e, 0x59, 0x00, 0x00, 0x00, //0x00000838 jle LBB0_3
0x41, 0xc6, 0x07, 0xe2, //0x0000083e movb $-30, (%r15)
0x49, 0x83, 0xc7, 0x01, //0x00000842 addq $1, %r15
0x49, 0x83, 0xc1, 0xff, //0x00000846 addq $-1, %r9
0x4c, 0x89, 0xd8, //0x0000084a movq %r11, %rax
0xe9, 0x94, 0xff, 0xff, 0xff, //0x0000084d jmp LBB0_105
//0x00000852 LBB0_84
0x48, 0x8b, 0x4d, 0xc8, //0x00000852 movq $-56(%rbp), %rcx
0x4c, 0x01, 0xe1, //0x00000856 addq %r12, %rcx
0x48, 0xf7, 0xd1, //0x00000859 notq %rcx
0x4c, 0x01, 0xf9, //0x0000085c addq %r15, %rcx
0x48, 0x8b, 0x45, 0xc0, //0x0000085f movq $-64(%rbp), %rax
0x48, 0x89, 0x08, //0x00000863 movq %rcx, (%rax)
0x48, 0x8b, 0x45, 0xd0, //0x00000866 movq $-48(%rbp), %rax
0x4c, 0x29, 0xd8, //0x0000086a subq %r11, %rax
0x4c, 0x01, 0xe0, //0x0000086d addq %r12, %rax
0xe9, 0x2c, 0x00, 0x00, 0x00, //0x00000870 jmp LBB0_107
//0x00000875 LBB0_86
0x4c, 0x89, 0xd8, //0x00000875 movq %r11, %rax
//0x00000878 LBB0_106
0x4c, 0x2b, 0x7d, 0xc8, //0x00000878 subq $-56(%rbp), %r15
0x48, 0x8b, 0x4d, 0xc0, //0x0000087c movq $-64(%rbp), %rcx
0x4c, 0x89, 0x39, //0x00000880 movq %r15, (%rcx)
0x48, 0x2b, 0x45, 0xd0, //0x00000883 subq $-48(%rbp), %rax
0xe9, 0x15, 0x00, 0x00, 0x00, //0x00000887 jmp LBB0_107
//0x0000088c LBB0_94
0x4c, 0x2b, 0x7d, 0xc8, //0x0000088c subq $-56(%rbp), %r15
0x48, 0x8b, 0x45, 0xc0, //0x00000890 movq $-64(%rbp), %rax
0x4c, 0x89, 0x38, //0x00000894 movq %r15, (%rax)
//0x00000897 LBB0_3
0x49, 0xf7, 0xd3, //0x00000897 notq %r11
0x4c, 0x03, 0x5d, 0xd0, //0x0000089a addq $-48(%rbp), %r11
0x4c, 0x89, 0xd8, //0x0000089e movq %r11, %rax
//0x000008a1 LBB0_107
0x48, 0x83, 0xc4, 0x18, //0x000008a1 addq $24, %rsp
0x5b, //0x000008a5 popq %rbx
0x41, 0x5c, //0x000008a6 popq %r12
0x41, 0x5d, //0x000008a8 popq %r13
0x41, 0x5e, //0x000008aa popq %r14
0x41, 0x5f, //0x000008ac popq %r15
0x5d, //0x000008ae popq %rbp
0xc5, 0xf8, 0x77, //0x000008af vzeroupper
0xc3, //0x000008b2 retq
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000008b3 .p2align 4, 0x00
//0x000008c0 __HtmlQuoteTab
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000008c0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000008d0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000008e0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000008f0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000900 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000910 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000920 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000930 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000940 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000950 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000960 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000970 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000980 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000990 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000009a0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000009b0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000009c0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000009d0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000009e0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000009f0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000a00 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000a10 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000a20 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000a30 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000a40 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000a50 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000a60 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000a70 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000a80 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000a90 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000aa0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000ab0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000ac0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000ad0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000ae0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000af0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000b00 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000b10 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000b20 .quad 6
0x5c, 0x75, 0x30, 0x30, 0x32, 0x36, 0x00, 0x00, //0x00000b28 QUAD $0x000036323030755c // .asciz 8, '\\u0026\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000b30 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000b40 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000b50 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000b60 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000b70 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000b80 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000b90 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000ba0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000bb0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000bc0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000bd0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000be0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000bf0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000c00 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000c10 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000c20 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000c30 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000c40 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000c50 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000c60 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000c70 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000c80 .quad 6
0x5c, 0x75, 0x30, 0x30, 0x33, 0x63, 0x00, 0x00, //0x00000c88 QUAD $0x000063333030755c // .asciz 8, '\\u003c\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000c90 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000ca0 .quad 6
0x5c, 0x75, 0x30, 0x30, 0x33, 0x65, 0x00, 0x00, //0x00000ca8 QUAD $0x000065333030755c // .asciz 8, '\\u003e\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000cb0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000cc0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000cd0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000ce0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000cf0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000d00 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000d10 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000d20 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000d30 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000d40 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000d50 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000d60 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000d70 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000d80 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000d90 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000da0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000db0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000dc0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000dd0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000de0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000df0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000e00 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000e10 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000e20 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000e30 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000e40 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000e50 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000e60 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000e70 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000e80 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000e90 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000ea0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000eb0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000ec0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000ed0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000ee0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000ef0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000f00 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000f10 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000f20 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000f30 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000f40 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000f50 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000f60 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000f70 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000f80 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000f90 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000fa0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000fb0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000fc0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000fd0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000fe0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00000ff0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001000 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001010 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001020 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001030 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001040 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001050 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001060 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001070 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001080 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001090 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000010a0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000010b0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000010c0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000010d0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000010e0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000010f0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001100 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001110 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001120 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001130 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001140 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001150 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001160 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001170 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001180 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001190 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000011a0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000011b0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000011c0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000011d0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000011e0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000011f0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001200 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001210 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001220 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001230 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001240 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001250 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001260 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001270 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001280 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001290 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000012a0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000012b0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000012c0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000012d0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000012e0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000012f0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001300 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001310 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001320 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001330 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001340 .quad 6
0x5c, 0x75, 0x32, 0x30, 0x32, 0x38, 0x00, 0x00, //0x00001348 QUAD $0x000038323032755c // .asciz 8, '\\u2028\x00\x00'
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001350 .quad 6
0x5c, 0x75, 0x32, 0x30, 0x32, 0x39, 0x00, 0x00, //0x00001358 QUAD $0x000039323032755c // .asciz 8, '\\u2029\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001360 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001370 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001380 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001390 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000013a0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000013b0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000013c0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000013d0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000013e0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000013f0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001400 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001410 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001420 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001430 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001440 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001450 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001460 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001470 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001480 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001490 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000014a0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000014b0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000014c0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000014d0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000014e0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000014f0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001500 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001510 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001520 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001530 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001540 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001550 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001560 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001570 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001580 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001590 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000015a0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000015b0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000015c0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000015d0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000015e0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000015f0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001600 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001610 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001620 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001630 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001640 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001650 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001660 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001670 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001680 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001690 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000016a0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000016b0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000016c0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000016d0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000016e0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000016f0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001700 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001710 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001720 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001730 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001740 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001750 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001760 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001770 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001780 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001790 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000017a0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000017b0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000017c0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000017d0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000017e0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000017f0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001800 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001810 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001820 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001830 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001840 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001850 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001860 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001870 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001880 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x00001890 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000018a0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000018b0 QUAD $0x0000000000000000; QUAD $0x0000000000000000 // .space 16, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
}

View File

@@ -0,0 +1,35 @@
// Code generated by scripts, DO NOT EDIT.
/*
* 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 avx2
import (
`unsafe`
`github.com/bytedance/sonic/internal/rt`
)
var F_i64toa func(out unsafe.Pointer, val int64) (ret int)
var S_i64toa uintptr
//go:nosplit
func i64toa(out *byte, val int64) (ret int) {
return F_i64toa(rt.NoEscape(unsafe.Pointer(out)), val)
}

View File

@@ -0,0 +1,47 @@
// +build !noasm !appengine
// Code generated by asm2asm, DO NOT EDIT.
package avx2
import (
`github.com/bytedance/sonic/loader`
)
const (
_entry__i64toa = 64
)
const (
_stack__i64toa = 8
)
const (
_size__i64toa = 2272
)
var (
_pcsp__i64toa = [][2]uint32{
{0x1, 0},
{0xae, 8},
{0xaf, 0},
{0x201, 8},
{0x202, 0},
{0x287, 8},
{0x288, 0},
{0x456, 8},
{0x457, 0},
{0x4e2, 8},
{0x4e3, 0},
{0x610, 8},
{0x611, 0},
{0x771, 8},
{0x772, 0},
{0x8d9, 8},
{0x8e0, 0},
}
)
var _cfunc_i64toa = []loader.CFunc{
{"_i64toa_entry", 0, _entry__i64toa, 0, nil},
{"_i64toa", _entry__i64toa, _size__i64toa, _stack__i64toa, _pcsp__i64toa},
}

View File

@@ -0,0 +1,631 @@
// +build amd64
// Code generated by asm2asm, DO NOT EDIT.
package avx2
var _text_i64toa = []byte{
// .p2align 4, 0x00
// LCPI0_0
0x59, 0x17, 0xb7, 0xd1, 0x00, 0x00, 0x00, 0x00, // .quad 3518437209
0x59, 0x17, 0xb7, 0xd1, 0x00, 0x00, 0x00, 0x00, //0x00000008 .quad 3518437209
//0x00000010 LCPI0_3
0x0a, 0x00, //0x00000010 .word 10
0x0a, 0x00, //0x00000012 .word 10
0x0a, 0x00, //0x00000014 .word 10
0x0a, 0x00, //0x00000016 .word 10
0x0a, 0x00, //0x00000018 .word 10
0x0a, 0x00, //0x0000001a .word 10
0x0a, 0x00, //0x0000001c .word 10
0x0a, 0x00, //0x0000001e .word 10
//0x00000020 LCPI0_4
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, //0x00000020 QUAD $0x3030303030303030; QUAD $0x3030303030303030 // .space 16, '0000000000000000'
//0x00000030 .p2align 3, 0x00
//0x00000030 LCPI0_1
0xc5, 0x20, 0x7b, 0x14, 0x34, 0x33, 0x00, 0x80, //0x00000030 .quad -9223315738079846203
//0x00000038 LCPI0_2
0x80, 0x00, 0x00, 0x08, 0x00, 0x20, 0x00, 0x80, //0x00000038 .quad -9223336852348469120
//0x00000040 .p2align 4, 0x90
//0x00000040 _i64toa
0x55, //0x00000040 pushq %rbp
0x48, 0x89, 0xe5, //0x00000041 movq %rsp, %rbp
0x48, 0x85, 0xf6, //0x00000044 testq %rsi, %rsi
0x0f, 0x88, 0xb2, 0x00, 0x00, 0x00, //0x00000047 js LBB0_25
0x48, 0x81, 0xfe, 0x0f, 0x27, 0x00, 0x00, //0x0000004d cmpq $9999, %rsi
0x0f, 0x87, 0xfb, 0x00, 0x00, 0x00, //0x00000054 ja LBB0_9
0x0f, 0xb7, 0xc6, //0x0000005a movzwl %si, %eax
0xc1, 0xe8, 0x02, //0x0000005d shrl $2, %eax
0x69, 0xc0, 0x7b, 0x14, 0x00, 0x00, //0x00000060 imull $5243, %eax, %eax
0xc1, 0xe8, 0x11, //0x00000066 shrl $17, %eax
0x48, 0x8d, 0x14, 0x00, //0x00000069 leaq (%rax,%rax), %rdx
0x6b, 0xc0, 0x64, //0x0000006d imull $100, %eax, %eax
0x89, 0xf1, //0x00000070 movl %esi, %ecx
0x29, 0xc1, //0x00000072 subl %eax, %ecx
0x0f, 0xb7, 0xc1, //0x00000074 movzwl %cx, %eax
0x48, 0x01, 0xc0, //0x00000077 addq %rax, %rax
0x81, 0xfe, 0xe8, 0x03, 0x00, 0x00, //0x0000007a cmpl $1000, %esi
0x0f, 0x82, 0x16, 0x00, 0x00, 0x00, //0x00000080 jb LBB0_4
0x48, 0x8d, 0x0d, 0x93, 0x08, 0x00, 0x00, //0x00000086 leaq $2195(%rip), %rcx /* _Digits+0(%rip) */
0x8a, 0x0c, 0x0a, //0x0000008d movb (%rdx,%rcx), %cl
0x88, 0x0f, //0x00000090 movb %cl, (%rdi)
0xb9, 0x01, 0x00, 0x00, 0x00, //0x00000092 movl $1, %ecx
0xe9, 0x0b, 0x00, 0x00, 0x00, //0x00000097 jmp LBB0_5
//0x0000009c LBB0_4
0x31, 0xc9, //0x0000009c xorl %ecx, %ecx
0x83, 0xfe, 0x64, //0x0000009e cmpl $100, %esi
0x0f, 0x82, 0x48, 0x00, 0x00, 0x00, //0x000000a1 jb LBB0_6
//0x000000a7 LBB0_5
0x0f, 0xb7, 0xd2, //0x000000a7 movzwl %dx, %edx
0x48, 0x83, 0xca, 0x01, //0x000000aa orq $1, %rdx
0x48, 0x8d, 0x35, 0x6b, 0x08, 0x00, 0x00, //0x000000ae leaq $2155(%rip), %rsi /* _Digits+0(%rip) */
0x8a, 0x14, 0x32, //0x000000b5 movb (%rdx,%rsi), %dl
0x89, 0xce, //0x000000b8 movl %ecx, %esi
0x83, 0xc1, 0x01, //0x000000ba addl $1, %ecx
0x88, 0x14, 0x37, //0x000000bd movb %dl, (%rdi,%rsi)
//0x000000c0 LBB0_7
0x48, 0x8d, 0x15, 0x59, 0x08, 0x00, 0x00, //0x000000c0 leaq $2137(%rip), %rdx /* _Digits+0(%rip) */
0x8a, 0x14, 0x10, //0x000000c7 movb (%rax,%rdx), %dl
0x89, 0xce, //0x000000ca movl %ecx, %esi
0x83, 0xc1, 0x01, //0x000000cc addl $1, %ecx
0x88, 0x14, 0x37, //0x000000cf movb %dl, (%rdi,%rsi)
//0x000000d2 LBB0_8
0x0f, 0xb7, 0xc0, //0x000000d2 movzwl %ax, %eax
0x48, 0x83, 0xc8, 0x01, //0x000000d5 orq $1, %rax
0x48, 0x8d, 0x15, 0x40, 0x08, 0x00, 0x00, //0x000000d9 leaq $2112(%rip), %rdx /* _Digits+0(%rip) */
0x8a, 0x04, 0x10, //0x000000e0 movb (%rax,%rdx), %al
0x89, 0xca, //0x000000e3 movl %ecx, %edx
0x83, 0xc1, 0x01, //0x000000e5 addl $1, %ecx
0x88, 0x04, 0x17, //0x000000e8 movb %al, (%rdi,%rdx)
0x89, 0xc8, //0x000000eb movl %ecx, %eax
0x5d, //0x000000ed popq %rbp
0xc3, //0x000000ee retq
//0x000000ef LBB0_6
0x31, 0xc9, //0x000000ef xorl %ecx, %ecx
0x83, 0xfe, 0x0a, //0x000000f1 cmpl $10, %esi
0x0f, 0x83, 0xc6, 0xff, 0xff, 0xff, //0x000000f4 jae LBB0_7
0xe9, 0xd3, 0xff, 0xff, 0xff, //0x000000fa jmp LBB0_8
//0x000000ff LBB0_25
0xc6, 0x07, 0x2d, //0x000000ff movb $45, (%rdi)
0x48, 0xf7, 0xde, //0x00000102 negq %rsi
0x48, 0x81, 0xfe, 0x0f, 0x27, 0x00, 0x00, //0x00000105 cmpq $9999, %rsi
0x0f, 0x87, 0xd9, 0x01, 0x00, 0x00, //0x0000010c ja LBB0_33
0x0f, 0xb7, 0xc6, //0x00000112 movzwl %si, %eax
0xc1, 0xe8, 0x02, //0x00000115 shrl $2, %eax
0x69, 0xc0, 0x7b, 0x14, 0x00, 0x00, //0x00000118 imull $5243, %eax, %eax
0xc1, 0xe8, 0x11, //0x0000011e shrl $17, %eax
0x48, 0x8d, 0x14, 0x00, //0x00000121 leaq (%rax,%rax), %rdx
0x6b, 0xc0, 0x64, //0x00000125 imull $100, %eax, %eax
0x89, 0xf1, //0x00000128 movl %esi, %ecx
0x29, 0xc1, //0x0000012a subl %eax, %ecx
0x0f, 0xb7, 0xc1, //0x0000012c movzwl %cx, %eax
0x48, 0x01, 0xc0, //0x0000012f addq %rax, %rax
0x81, 0xfe, 0xe8, 0x03, 0x00, 0x00, //0x00000132 cmpl $1000, %esi
0x0f, 0x82, 0xab, 0x00, 0x00, 0x00, //0x00000138 jb LBB0_28
0x48, 0x8d, 0x0d, 0xdb, 0x07, 0x00, 0x00, //0x0000013e leaq $2011(%rip), %rcx /* _Digits+0(%rip) */
0x8a, 0x0c, 0x0a, //0x00000145 movb (%rdx,%rcx), %cl
0x88, 0x4f, 0x01, //0x00000148 movb %cl, $1(%rdi)
0xb9, 0x01, 0x00, 0x00, 0x00, //0x0000014b movl $1, %ecx
0xe9, 0x9f, 0x00, 0x00, 0x00, //0x00000150 jmp LBB0_29
//0x00000155 LBB0_9
0x48, 0x81, 0xfe, 0xff, 0xe0, 0xf5, 0x05, //0x00000155 cmpq $99999999, %rsi
0x0f, 0x87, 0x1e, 0x02, 0x00, 0x00, //0x0000015c ja LBB0_17
0x89, 0xf0, //0x00000162 movl %esi, %eax
0xba, 0x59, 0x17, 0xb7, 0xd1, //0x00000164 movl $3518437209, %edx
0x48, 0x0f, 0xaf, 0xd0, //0x00000169 imulq %rax, %rdx
0x48, 0xc1, 0xea, 0x2d, //0x0000016d shrq $45, %rdx
0x44, 0x69, 0xc2, 0x10, 0x27, 0x00, 0x00, //0x00000171 imull $10000, %edx, %r8d
0x89, 0xf1, //0x00000178 movl %esi, %ecx
0x44, 0x29, 0xc1, //0x0000017a subl %r8d, %ecx
0x4c, 0x69, 0xd0, 0x83, 0xde, 0x1b, 0x43, //0x0000017d imulq $1125899907, %rax, %r10
0x49, 0xc1, 0xea, 0x31, //0x00000184 shrq $49, %r10
0x41, 0x83, 0xe2, 0xfe, //0x00000188 andl $-2, %r10d
0x0f, 0xb7, 0xc2, //0x0000018c movzwl %dx, %eax
0xc1, 0xe8, 0x02, //0x0000018f shrl $2, %eax
0x69, 0xc0, 0x7b, 0x14, 0x00, 0x00, //0x00000192 imull $5243, %eax, %eax
0xc1, 0xe8, 0x11, //0x00000198 shrl $17, %eax
0x6b, 0xc0, 0x64, //0x0000019b imull $100, %eax, %eax
0x29, 0xc2, //0x0000019e subl %eax, %edx
0x44, 0x0f, 0xb7, 0xca, //0x000001a0 movzwl %dx, %r9d
0x4d, 0x01, 0xc9, //0x000001a4 addq %r9, %r9
0x0f, 0xb7, 0xc1, //0x000001a7 movzwl %cx, %eax
0xc1, 0xe8, 0x02, //0x000001aa shrl $2, %eax
0x69, 0xc0, 0x7b, 0x14, 0x00, 0x00, //0x000001ad imull $5243, %eax, %eax
0xc1, 0xe8, 0x11, //0x000001b3 shrl $17, %eax
0x4c, 0x8d, 0x04, 0x00, //0x000001b6 leaq (%rax,%rax), %r8
0x6b, 0xc0, 0x64, //0x000001ba imull $100, %eax, %eax
0x29, 0xc1, //0x000001bd subl %eax, %ecx
0x44, 0x0f, 0xb7, 0xd9, //0x000001bf movzwl %cx, %r11d
0x4d, 0x01, 0xdb, //0x000001c3 addq %r11, %r11
0x81, 0xfe, 0x80, 0x96, 0x98, 0x00, //0x000001c6 cmpl $10000000, %esi
0x0f, 0x82, 0x70, 0x00, 0x00, 0x00, //0x000001cc jb LBB0_12
0x48, 0x8d, 0x05, 0x47, 0x07, 0x00, 0x00, //0x000001d2 leaq $1863(%rip), %rax /* _Digits+0(%rip) */
0x41, 0x8a, 0x04, 0x02, //0x000001d9 movb (%r10,%rax), %al
0x88, 0x07, //0x000001dd movb %al, (%rdi)
0xb9, 0x01, 0x00, 0x00, 0x00, //0x000001df movl $1, %ecx
0xe9, 0x67, 0x00, 0x00, 0x00, //0x000001e4 jmp LBB0_13
//0x000001e9 LBB0_28
0x31, 0xc9, //0x000001e9 xorl %ecx, %ecx
0x83, 0xfe, 0x64, //0x000001eb cmpl $100, %esi
0x0f, 0x82, 0xd4, 0x00, 0x00, 0x00, //0x000001ee jb LBB0_30
//0x000001f4 LBB0_29
0x0f, 0xb7, 0xd2, //0x000001f4 movzwl %dx, %edx
0x48, 0x83, 0xca, 0x01, //0x000001f7 orq $1, %rdx
0x48, 0x8d, 0x35, 0x1e, 0x07, 0x00, 0x00, //0x000001fb leaq $1822(%rip), %rsi /* _Digits+0(%rip) */
0x8a, 0x14, 0x32, //0x00000202 movb (%rdx,%rsi), %dl
0x89, 0xce, //0x00000205 movl %ecx, %esi
0x83, 0xc1, 0x01, //0x00000207 addl $1, %ecx
0x88, 0x54, 0x37, 0x01, //0x0000020a movb %dl, $1(%rdi,%rsi)
//0x0000020e LBB0_31
0x48, 0x8d, 0x15, 0x0b, 0x07, 0x00, 0x00, //0x0000020e leaq $1803(%rip), %rdx /* _Digits+0(%rip) */
0x8a, 0x14, 0x10, //0x00000215 movb (%rax,%rdx), %dl
0x89, 0xce, //0x00000218 movl %ecx, %esi
0x83, 0xc1, 0x01, //0x0000021a addl $1, %ecx
0x88, 0x54, 0x37, 0x01, //0x0000021d movb %dl, $1(%rdi,%rsi)
//0x00000221 LBB0_32
0x0f, 0xb7, 0xc0, //0x00000221 movzwl %ax, %eax
0x48, 0x83, 0xc8, 0x01, //0x00000224 orq $1, %rax
0x48, 0x8d, 0x15, 0xf1, 0x06, 0x00, 0x00, //0x00000228 leaq $1777(%rip), %rdx /* _Digits+0(%rip) */
0x8a, 0x04, 0x10, //0x0000022f movb (%rax,%rdx), %al
0x89, 0xca, //0x00000232 movl %ecx, %edx
0x83, 0xc1, 0x01, //0x00000234 addl $1, %ecx
0x88, 0x44, 0x17, 0x01, //0x00000237 movb %al, $1(%rdi,%rdx)
0x83, 0xc1, 0x01, //0x0000023b addl $1, %ecx
0x89, 0xc8, //0x0000023e movl %ecx, %eax
0x5d, //0x00000240 popq %rbp
0xc3, //0x00000241 retq
//0x00000242 LBB0_12
0x31, 0xc9, //0x00000242 xorl %ecx, %ecx
0x81, 0xfe, 0x40, 0x42, 0x0f, 0x00, //0x00000244 cmpl $1000000, %esi
0x0f, 0x82, 0x88, 0x00, 0x00, 0x00, //0x0000024a jb LBB0_14
//0x00000250 LBB0_13
0x44, 0x89, 0xd0, //0x00000250 movl %r10d, %eax
0x48, 0x83, 0xc8, 0x01, //0x00000253 orq $1, %rax
0x48, 0x8d, 0x35, 0xc2, 0x06, 0x00, 0x00, //0x00000257 leaq $1730(%rip), %rsi /* _Digits+0(%rip) */
0x8a, 0x04, 0x30, //0x0000025e movb (%rax,%rsi), %al
0x89, 0xce, //0x00000261 movl %ecx, %esi
0x83, 0xc1, 0x01, //0x00000263 addl $1, %ecx
0x88, 0x04, 0x37, //0x00000266 movb %al, (%rdi,%rsi)
//0x00000269 LBB0_15
0x48, 0x8d, 0x05, 0xb0, 0x06, 0x00, 0x00, //0x00000269 leaq $1712(%rip), %rax /* _Digits+0(%rip) */
0x41, 0x8a, 0x04, 0x01, //0x00000270 movb (%r9,%rax), %al
0x89, 0xce, //0x00000274 movl %ecx, %esi
0x83, 0xc1, 0x01, //0x00000276 addl $1, %ecx
0x88, 0x04, 0x37, //0x00000279 movb %al, (%rdi,%rsi)
//0x0000027c LBB0_16
0x41, 0x0f, 0xb7, 0xc1, //0x0000027c movzwl %r9w, %eax
0x48, 0x83, 0xc8, 0x01, //0x00000280 orq $1, %rax
0x48, 0x8d, 0x35, 0x95, 0x06, 0x00, 0x00, //0x00000284 leaq $1685(%rip), %rsi /* _Digits+0(%rip) */
0x8a, 0x04, 0x30, //0x0000028b movb (%rax,%rsi), %al
0x89, 0xca, //0x0000028e movl %ecx, %edx
0x88, 0x04, 0x17, //0x00000290 movb %al, (%rdi,%rdx)
0x41, 0x8a, 0x04, 0x30, //0x00000293 movb (%r8,%rsi), %al
0x88, 0x44, 0x17, 0x01, //0x00000297 movb %al, $1(%rdi,%rdx)
0x41, 0x0f, 0xb7, 0xc0, //0x0000029b movzwl %r8w, %eax
0x48, 0x83, 0xc8, 0x01, //0x0000029f orq $1, %rax
0x8a, 0x04, 0x30, //0x000002a3 movb (%rax,%rsi), %al
0x88, 0x44, 0x17, 0x02, //0x000002a6 movb %al, $2(%rdi,%rdx)
0x41, 0x8a, 0x04, 0x33, //0x000002aa movb (%r11,%rsi), %al
0x88, 0x44, 0x17, 0x03, //0x000002ae movb %al, $3(%rdi,%rdx)
0x41, 0x0f, 0xb7, 0xc3, //0x000002b2 movzwl %r11w, %eax
0x48, 0x83, 0xc8, 0x01, //0x000002b6 orq $1, %rax
0x8a, 0x04, 0x30, //0x000002ba movb (%rax,%rsi), %al
0x83, 0xc1, 0x05, //0x000002bd addl $5, %ecx
0x88, 0x44, 0x17, 0x04, //0x000002c0 movb %al, $4(%rdi,%rdx)
0x89, 0xc8, //0x000002c4 movl %ecx, %eax
0x5d, //0x000002c6 popq %rbp
0xc3, //0x000002c7 retq
//0x000002c8 LBB0_30
0x31, 0xc9, //0x000002c8 xorl %ecx, %ecx
0x83, 0xfe, 0x0a, //0x000002ca cmpl $10, %esi
0x0f, 0x83, 0x3b, 0xff, 0xff, 0xff, //0x000002cd jae LBB0_31
0xe9, 0x49, 0xff, 0xff, 0xff, //0x000002d3 jmp LBB0_32
//0x000002d8 LBB0_14
0x31, 0xc9, //0x000002d8 xorl %ecx, %ecx
0x81, 0xfe, 0xa0, 0x86, 0x01, 0x00, //0x000002da cmpl $100000, %esi
0x0f, 0x83, 0x83, 0xff, 0xff, 0xff, //0x000002e0 jae LBB0_15
0xe9, 0x91, 0xff, 0xff, 0xff, //0x000002e6 jmp LBB0_16
//0x000002eb LBB0_33
0x48, 0x81, 0xfe, 0xff, 0xe0, 0xf5, 0x05, //0x000002eb cmpq $99999999, %rsi
0x0f, 0x87, 0x3e, 0x02, 0x00, 0x00, //0x000002f2 ja LBB0_41
0x89, 0xf0, //0x000002f8 movl %esi, %eax
0xba, 0x59, 0x17, 0xb7, 0xd1, //0x000002fa movl $3518437209, %edx
0x48, 0x0f, 0xaf, 0xd0, //0x000002ff imulq %rax, %rdx
0x48, 0xc1, 0xea, 0x2d, //0x00000303 shrq $45, %rdx
0x44, 0x69, 0xc2, 0x10, 0x27, 0x00, 0x00, //0x00000307 imull $10000, %edx, %r8d
0x89, 0xf1, //0x0000030e movl %esi, %ecx
0x44, 0x29, 0xc1, //0x00000310 subl %r8d, %ecx
0x4c, 0x69, 0xd0, 0x83, 0xde, 0x1b, 0x43, //0x00000313 imulq $1125899907, %rax, %r10
0x49, 0xc1, 0xea, 0x31, //0x0000031a shrq $49, %r10
0x41, 0x83, 0xe2, 0xfe, //0x0000031e andl $-2, %r10d
0x0f, 0xb7, 0xc2, //0x00000322 movzwl %dx, %eax
0xc1, 0xe8, 0x02, //0x00000325 shrl $2, %eax
0x69, 0xc0, 0x7b, 0x14, 0x00, 0x00, //0x00000328 imull $5243, %eax, %eax
0xc1, 0xe8, 0x11, //0x0000032e shrl $17, %eax
0x6b, 0xc0, 0x64, //0x00000331 imull $100, %eax, %eax
0x29, 0xc2, //0x00000334 subl %eax, %edx
0x44, 0x0f, 0xb7, 0xca, //0x00000336 movzwl %dx, %r9d
0x4d, 0x01, 0xc9, //0x0000033a addq %r9, %r9
0x0f, 0xb7, 0xc1, //0x0000033d movzwl %cx, %eax
0xc1, 0xe8, 0x02, //0x00000340 shrl $2, %eax
0x69, 0xc0, 0x7b, 0x14, 0x00, 0x00, //0x00000343 imull $5243, %eax, %eax
0xc1, 0xe8, 0x11, //0x00000349 shrl $17, %eax
0x4c, 0x8d, 0x04, 0x00, //0x0000034c leaq (%rax,%rax), %r8
0x6b, 0xc0, 0x64, //0x00000350 imull $100, %eax, %eax
0x29, 0xc1, //0x00000353 subl %eax, %ecx
0x44, 0x0f, 0xb7, 0xd9, //0x00000355 movzwl %cx, %r11d
0x4d, 0x01, 0xdb, //0x00000359 addq %r11, %r11
0x81, 0xfe, 0x80, 0x96, 0x98, 0x00, //0x0000035c cmpl $10000000, %esi
0x0f, 0x82, 0x2f, 0x01, 0x00, 0x00, //0x00000362 jb LBB0_36
0x48, 0x8d, 0x05, 0xb1, 0x05, 0x00, 0x00, //0x00000368 leaq $1457(%rip), %rax /* _Digits+0(%rip) */
0x41, 0x8a, 0x04, 0x02, //0x0000036f movb (%r10,%rax), %al
0x88, 0x47, 0x01, //0x00000373 movb %al, $1(%rdi)
0xb9, 0x01, 0x00, 0x00, 0x00, //0x00000376 movl $1, %ecx
0xe9, 0x25, 0x01, 0x00, 0x00, //0x0000037b jmp LBB0_37
//0x00000380 LBB0_17
0x48, 0xb9, 0x00, 0x00, 0xc1, 0x6f, 0xf2, 0x86, 0x23, 0x00, //0x00000380 movabsq $10000000000000000, %rcx
0x48, 0x39, 0xce, //0x0000038a cmpq %rcx, %rsi
0x0f, 0x83, 0xbe, 0x02, 0x00, 0x00, //0x0000038d jae LBB0_19
0x48, 0xb9, 0xfd, 0xce, 0x61, 0x84, 0x11, 0x77, 0xcc, 0xab, //0x00000393 movabsq $-6067343680855748867, %rcx
0x48, 0x89, 0xf0, //0x0000039d movq %rsi, %rax
0x48, 0xf7, 0xe1, //0x000003a0 mulq %rcx
0x48, 0xc1, 0xea, 0x1a, //0x000003a3 shrq $26, %rdx
0x69, 0xc2, 0x00, 0xe1, 0xf5, 0x05, //0x000003a7 imull $100000000, %edx, %eax
0x29, 0xc6, //0x000003ad subl %eax, %esi
0xc5, 0xf9, 0x6e, 0xc2, //0x000003af vmovd %edx, %xmm0
0xc5, 0xfa, 0x6f, 0x0d, 0x45, 0xfc, 0xff, 0xff, //0x000003b3 vmovdqu $-955(%rip), %xmm1 /* LCPI0_0+0(%rip) */
0xc5, 0xf9, 0xf4, 0xd1, //0x000003bb vpmuludq %xmm1, %xmm0, %xmm2
0xc5, 0xe9, 0x73, 0xd2, 0x2d, //0x000003bf vpsrlq $45, %xmm2, %xmm2
0xb8, 0x10, 0x27, 0x00, 0x00, //0x000003c4 movl $10000, %eax
0xc4, 0xe1, 0xf9, 0x6e, 0xd8, //0x000003c9 vmovq %rax, %xmm3
0xc5, 0xe9, 0xf4, 0xe3, //0x000003ce vpmuludq %xmm3, %xmm2, %xmm4
0xc5, 0xf9, 0xfa, 0xc4, //0x000003d2 vpsubd %xmm4, %xmm0, %xmm0
0xc5, 0xe9, 0x61, 0xc0, //0x000003d6 vpunpcklwd %xmm0, %xmm2, %xmm0
0xc5, 0xf9, 0x73, 0xf0, 0x02, //0x000003da vpsllq $2, %xmm0, %xmm0
0xc5, 0xfb, 0x70, 0xc0, 0x50, //0x000003df vpshuflw $80, %xmm0, %xmm0
0xc5, 0xf9, 0x70, 0xc0, 0x50, //0x000003e4 vpshufd $80, %xmm0, %xmm0
0xc4, 0xe2, 0x79, 0x59, 0x15, 0x3e, 0xfc, 0xff, 0xff, //0x000003e9 vpbroadcastq $-962(%rip), %xmm2 /* LCPI0_1+0(%rip) */
0xc4, 0xe2, 0x79, 0x59, 0x25, 0x3d, 0xfc, 0xff, 0xff, //0x000003f2 vpbroadcastq $-963(%rip), %xmm4 /* LCPI0_2+0(%rip) */
0xc5, 0xf9, 0xe4, 0xc2, //0x000003fb vpmulhuw %xmm2, %xmm0, %xmm0
0xc5, 0xf9, 0xe4, 0xc4, //0x000003ff vpmulhuw %xmm4, %xmm0, %xmm0
0xc5, 0xfa, 0x6f, 0x2d, 0x05, 0xfc, 0xff, 0xff, //0x00000403 vmovdqu $-1019(%rip), %xmm5 /* LCPI0_3+0(%rip) */
0xc5, 0xf9, 0xd5, 0xf5, //0x0000040b vpmullw %xmm5, %xmm0, %xmm6
0xc5, 0xc9, 0x73, 0xf6, 0x10, //0x0000040f vpsllq $16, %xmm6, %xmm6
0xc5, 0xf9, 0xf9, 0xc6, //0x00000414 vpsubw %xmm6, %xmm0, %xmm0
0xc5, 0xf9, 0x6e, 0xf6, //0x00000418 vmovd %esi, %xmm6
0xc5, 0xc9, 0xf4, 0xc9, //0x0000041c vpmuludq %xmm1, %xmm6, %xmm1
0xc5, 0xf1, 0x73, 0xd1, 0x2d, //0x00000420 vpsrlq $45, %xmm1, %xmm1
0xc5, 0xf1, 0xf4, 0xdb, //0x00000425 vpmuludq %xmm3, %xmm1, %xmm3
0xc5, 0xc9, 0xfa, 0xdb, //0x00000429 vpsubd %xmm3, %xmm6, %xmm3
0xc5, 0xf1, 0x61, 0xcb, //0x0000042d vpunpcklwd %xmm3, %xmm1, %xmm1
0xc5, 0xf1, 0x73, 0xf1, 0x02, //0x00000431 vpsllq $2, %xmm1, %xmm1
0xc5, 0xfb, 0x70, 0xc9, 0x50, //0x00000436 vpshuflw $80, %xmm1, %xmm1
0xc5, 0xf9, 0x70, 0xc9, 0x50, //0x0000043b vpshufd $80, %xmm1, %xmm1
0xc5, 0xf1, 0xe4, 0xca, //0x00000440 vpmulhuw %xmm2, %xmm1, %xmm1
0xc5, 0xf1, 0xe4, 0xcc, //0x00000444 vpmulhuw %xmm4, %xmm1, %xmm1
0xc5, 0xf1, 0xd5, 0xd5, //0x00000448 vpmullw %xmm5, %xmm1, %xmm2
0xc5, 0xe9, 0x73, 0xf2, 0x10, //0x0000044c vpsllq $16, %xmm2, %xmm2
0xc5, 0xf1, 0xf9, 0xca, //0x00000451 vpsubw %xmm2, %xmm1, %xmm1
0xc5, 0xf9, 0x67, 0xc1, //0x00000455 vpackuswb %xmm1, %xmm0, %xmm0
0xc5, 0xf9, 0xfc, 0x0d, 0xbf, 0xfb, 0xff, 0xff, //0x00000459 vpaddb $-1089(%rip), %xmm0, %xmm1 /* LCPI0_4+0(%rip) */
0xc5, 0xe9, 0xef, 0xd2, //0x00000461 vpxor %xmm2, %xmm2, %xmm2
0xc5, 0xf9, 0x74, 0xc2, //0x00000465 vpcmpeqb %xmm2, %xmm0, %xmm0
0xc5, 0xf9, 0xd7, 0xc0, //0x00000469 vpmovmskb %xmm0, %eax
0xf7, 0xd0, //0x0000046d notl %eax
0x0d, 0x00, 0x80, 0x00, 0x00, //0x0000046f orl $32768, %eax
0x0f, 0xbc, 0xc0, //0x00000474 bsfl %eax, %eax
0xb9, 0x10, 0x00, 0x00, 0x00, //0x00000477 movl $16, %ecx
0x29, 0xc1, //0x0000047c subl %eax, %ecx
0x48, 0xc1, 0xe0, 0x04, //0x0000047e shlq $4, %rax
0x48, 0x8d, 0x15, 0x67, 0x05, 0x00, 0x00, //0x00000482 leaq $1383(%rip), %rdx /* _VecShiftShuffles+0(%rip) */
0xc4, 0xe2, 0x71, 0x00, 0x04, 0x10, //0x00000489 vpshufb (%rax,%rdx), %xmm1, %xmm0
0xc5, 0xfa, 0x7f, 0x07, //0x0000048f vmovdqu %xmm0, (%rdi)
0x89, 0xc8, //0x00000493 movl %ecx, %eax
0x5d, //0x00000495 popq %rbp
0xc3, //0x00000496 retq
//0x00000497 LBB0_36
0x31, 0xc9, //0x00000497 xorl %ecx, %ecx
0x81, 0xfe, 0x40, 0x42, 0x0f, 0x00, //0x00000499 cmpl $1000000, %esi
0x0f, 0x82, 0x7e, 0x00, 0x00, 0x00, //0x0000049f jb LBB0_38
//0x000004a5 LBB0_37
0x44, 0x89, 0xd0, //0x000004a5 movl %r10d, %eax
0x48, 0x83, 0xc8, 0x01, //0x000004a8 orq $1, %rax
0x48, 0x8d, 0x35, 0x6d, 0x04, 0x00, 0x00, //0x000004ac leaq $1133(%rip), %rsi /* _Digits+0(%rip) */
0x8a, 0x04, 0x30, //0x000004b3 movb (%rax,%rsi), %al
0x89, 0xce, //0x000004b6 movl %ecx, %esi
0x83, 0xc1, 0x01, //0x000004b8 addl $1, %ecx
0x88, 0x44, 0x37, 0x01, //0x000004bb movb %al, $1(%rdi,%rsi)
//0x000004bf LBB0_39
0x48, 0x8d, 0x05, 0x5a, 0x04, 0x00, 0x00, //0x000004bf leaq $1114(%rip), %rax /* _Digits+0(%rip) */
0x41, 0x8a, 0x04, 0x01, //0x000004c6 movb (%r9,%rax), %al
0x89, 0xce, //0x000004ca movl %ecx, %esi
0x83, 0xc1, 0x01, //0x000004cc addl $1, %ecx
0x88, 0x44, 0x37, 0x01, //0x000004cf movb %al, $1(%rdi,%rsi)
//0x000004d3 LBB0_40
0x41, 0x0f, 0xb7, 0xc1, //0x000004d3 movzwl %r9w, %eax
0x48, 0x83, 0xc8, 0x01, //0x000004d7 orq $1, %rax
0x48, 0x8d, 0x35, 0x3e, 0x04, 0x00, 0x00, //0x000004db leaq $1086(%rip), %rsi /* _Digits+0(%rip) */
0x8a, 0x04, 0x30, //0x000004e2 movb (%rax,%rsi), %al
0x89, 0xca, //0x000004e5 movl %ecx, %edx
0x88, 0x44, 0x17, 0x01, //0x000004e7 movb %al, $1(%rdi,%rdx)
0x41, 0x8a, 0x04, 0x30, //0x000004eb movb (%r8,%rsi), %al
0x88, 0x44, 0x17, 0x02, //0x000004ef movb %al, $2(%rdi,%rdx)
0x41, 0x0f, 0xb7, 0xc0, //0x000004f3 movzwl %r8w, %eax
0x48, 0x83, 0xc8, 0x01, //0x000004f7 orq $1, %rax
0x8a, 0x04, 0x30, //0x000004fb movb (%rax,%rsi), %al
0x88, 0x44, 0x17, 0x03, //0x000004fe movb %al, $3(%rdi,%rdx)
0x41, 0x8a, 0x04, 0x33, //0x00000502 movb (%r11,%rsi), %al
0x88, 0x44, 0x17, 0x04, //0x00000506 movb %al, $4(%rdi,%rdx)
0x41, 0x0f, 0xb7, 0xc3, //0x0000050a movzwl %r11w, %eax
0x48, 0x83, 0xc8, 0x01, //0x0000050e orq $1, %rax
0x8a, 0x04, 0x30, //0x00000512 movb (%rax,%rsi), %al
0x83, 0xc1, 0x05, //0x00000515 addl $5, %ecx
0x88, 0x44, 0x17, 0x05, //0x00000518 movb %al, $5(%rdi,%rdx)
0x83, 0xc1, 0x01, //0x0000051c addl $1, %ecx
0x89, 0xc8, //0x0000051f movl %ecx, %eax
0x5d, //0x00000521 popq %rbp
0xc3, //0x00000522 retq
//0x00000523 LBB0_38
0x31, 0xc9, //0x00000523 xorl %ecx, %ecx
0x81, 0xfe, 0xa0, 0x86, 0x01, 0x00, //0x00000525 cmpl $100000, %esi
0x0f, 0x83, 0x8e, 0xff, 0xff, 0xff, //0x0000052b jae LBB0_39
0xe9, 0x9d, 0xff, 0xff, 0xff, //0x00000531 jmp LBB0_40
//0x00000536 LBB0_41
0x48, 0xb9, 0x00, 0x00, 0xc1, 0x6f, 0xf2, 0x86, 0x23, 0x00, //0x00000536 movabsq $10000000000000000, %rcx
0x48, 0x39, 0xce, //0x00000540 cmpq %rcx, %rsi
0x0f, 0x83, 0x69, 0x02, 0x00, 0x00, //0x00000543 jae LBB0_43
0x48, 0xb9, 0xfd, 0xce, 0x61, 0x84, 0x11, 0x77, 0xcc, 0xab, //0x00000549 movabsq $-6067343680855748867, %rcx
0x48, 0x89, 0xf0, //0x00000553 movq %rsi, %rax
0x48, 0xf7, 0xe1, //0x00000556 mulq %rcx
0x48, 0xc1, 0xea, 0x1a, //0x00000559 shrq $26, %rdx
0x69, 0xc2, 0x00, 0xe1, 0xf5, 0x05, //0x0000055d imull $100000000, %edx, %eax
0x29, 0xc6, //0x00000563 subl %eax, %esi
0xc5, 0xf9, 0x6e, 0xc2, //0x00000565 vmovd %edx, %xmm0
0xc5, 0xfa, 0x6f, 0x0d, 0x8f, 0xfa, 0xff, 0xff, //0x00000569 vmovdqu $-1393(%rip), %xmm1 /* LCPI0_0+0(%rip) */
0xc5, 0xf9, 0xf4, 0xd1, //0x00000571 vpmuludq %xmm1, %xmm0, %xmm2
0xc5, 0xe9, 0x73, 0xd2, 0x2d, //0x00000575 vpsrlq $45, %xmm2, %xmm2
0xb8, 0x10, 0x27, 0x00, 0x00, //0x0000057a movl $10000, %eax
0xc4, 0xe1, 0xf9, 0x6e, 0xd8, //0x0000057f vmovq %rax, %xmm3
0xc5, 0xe9, 0xf4, 0xe3, //0x00000584 vpmuludq %xmm3, %xmm2, %xmm4
0xc5, 0xf9, 0xfa, 0xc4, //0x00000588 vpsubd %xmm4, %xmm0, %xmm0
0xc5, 0xe9, 0x61, 0xc0, //0x0000058c vpunpcklwd %xmm0, %xmm2, %xmm0
0xc5, 0xf9, 0x73, 0xf0, 0x02, //0x00000590 vpsllq $2, %xmm0, %xmm0
0xc5, 0xfb, 0x70, 0xc0, 0x50, //0x00000595 vpshuflw $80, %xmm0, %xmm0
0xc5, 0xf9, 0x70, 0xc0, 0x50, //0x0000059a vpshufd $80, %xmm0, %xmm0
0xc4, 0xe2, 0x79, 0x59, 0x15, 0x88, 0xfa, 0xff, 0xff, //0x0000059f vpbroadcastq $-1400(%rip), %xmm2 /* LCPI0_1+0(%rip) */
0xc4, 0xe2, 0x79, 0x59, 0x25, 0x87, 0xfa, 0xff, 0xff, //0x000005a8 vpbroadcastq $-1401(%rip), %xmm4 /* LCPI0_2+0(%rip) */
0xc5, 0xf9, 0xe4, 0xc2, //0x000005b1 vpmulhuw %xmm2, %xmm0, %xmm0
0xc5, 0xf9, 0xe4, 0xc4, //0x000005b5 vpmulhuw %xmm4, %xmm0, %xmm0
0xc5, 0xfa, 0x6f, 0x2d, 0x4f, 0xfa, 0xff, 0xff, //0x000005b9 vmovdqu $-1457(%rip), %xmm5 /* LCPI0_3+0(%rip) */
0xc5, 0xf9, 0xd5, 0xf5, //0x000005c1 vpmullw %xmm5, %xmm0, %xmm6
0xc5, 0xc9, 0x73, 0xf6, 0x10, //0x000005c5 vpsllq $16, %xmm6, %xmm6
0xc5, 0xf9, 0xf9, 0xc6, //0x000005ca vpsubw %xmm6, %xmm0, %xmm0
0xc5, 0xf9, 0x6e, 0xf6, //0x000005ce vmovd %esi, %xmm6
0xc5, 0xc9, 0xf4, 0xc9, //0x000005d2 vpmuludq %xmm1, %xmm6, %xmm1
0xc5, 0xf1, 0x73, 0xd1, 0x2d, //0x000005d6 vpsrlq $45, %xmm1, %xmm1
0xc5, 0xf1, 0xf4, 0xdb, //0x000005db vpmuludq %xmm3, %xmm1, %xmm3
0xc5, 0xc9, 0xfa, 0xdb, //0x000005df vpsubd %xmm3, %xmm6, %xmm3
0xc5, 0xf1, 0x61, 0xcb, //0x000005e3 vpunpcklwd %xmm3, %xmm1, %xmm1
0xc5, 0xf1, 0x73, 0xf1, 0x02, //0x000005e7 vpsllq $2, %xmm1, %xmm1
0xc5, 0xfb, 0x70, 0xc9, 0x50, //0x000005ec vpshuflw $80, %xmm1, %xmm1
0xc5, 0xf9, 0x70, 0xc9, 0x50, //0x000005f1 vpshufd $80, %xmm1, %xmm1
0xc5, 0xf1, 0xe4, 0xca, //0x000005f6 vpmulhuw %xmm2, %xmm1, %xmm1
0xc5, 0xf1, 0xe4, 0xcc, //0x000005fa vpmulhuw %xmm4, %xmm1, %xmm1
0xc5, 0xf1, 0xd5, 0xd5, //0x000005fe vpmullw %xmm5, %xmm1, %xmm2
0xc5, 0xe9, 0x73, 0xf2, 0x10, //0x00000602 vpsllq $16, %xmm2, %xmm2
0xc5, 0xf1, 0xf9, 0xca, //0x00000607 vpsubw %xmm2, %xmm1, %xmm1
0xc5, 0xf9, 0x67, 0xc1, //0x0000060b vpackuswb %xmm1, %xmm0, %xmm0
0xc5, 0xf9, 0xfc, 0x0d, 0x09, 0xfa, 0xff, 0xff, //0x0000060f vpaddb $-1527(%rip), %xmm0, %xmm1 /* LCPI0_4+0(%rip) */
0xc5, 0xe9, 0xef, 0xd2, //0x00000617 vpxor %xmm2, %xmm2, %xmm2
0xc5, 0xf9, 0x74, 0xc2, //0x0000061b vpcmpeqb %xmm2, %xmm0, %xmm0
0xc5, 0xf9, 0xd7, 0xc0, //0x0000061f vpmovmskb %xmm0, %eax
0xf7, 0xd0, //0x00000623 notl %eax
0x0d, 0x00, 0x80, 0x00, 0x00, //0x00000625 orl $32768, %eax
0x0f, 0xbc, 0xc0, //0x0000062a bsfl %eax, %eax
0xb9, 0x10, 0x00, 0x00, 0x00, //0x0000062d movl $16, %ecx
0x29, 0xc1, //0x00000632 subl %eax, %ecx
0x48, 0xc1, 0xe0, 0x04, //0x00000634 shlq $4, %rax
0x48, 0x8d, 0x15, 0xb1, 0x03, 0x00, 0x00, //0x00000638 leaq $945(%rip), %rdx /* _VecShiftShuffles+0(%rip) */
0xc4, 0xe2, 0x71, 0x00, 0x04, 0x10, //0x0000063f vpshufb (%rax,%rdx), %xmm1, %xmm0
0xc5, 0xfa, 0x7f, 0x47, 0x01, //0x00000645 vmovdqu %xmm0, $1(%rdi)
0x83, 0xc1, 0x01, //0x0000064a addl $1, %ecx
0x89, 0xc8, //0x0000064d movl %ecx, %eax
0x5d, //0x0000064f popq %rbp
0xc3, //0x00000650 retq
//0x00000651 LBB0_19
0x48, 0xba, 0x57, 0x78, 0x13, 0xb1, 0x2f, 0x65, 0xa5, 0x39, //0x00000651 movabsq $4153837486827862103, %rdx
0x48, 0x89, 0xf0, //0x0000065b movq %rsi, %rax
0x48, 0xf7, 0xe2, //0x0000065e mulq %rdx
0x48, 0xc1, 0xea, 0x33, //0x00000661 shrq $51, %rdx
0x48, 0x0f, 0xaf, 0xca, //0x00000665 imulq %rdx, %rcx
0x48, 0x29, 0xce, //0x00000669 subq %rcx, %rsi
0x83, 0xfa, 0x09, //0x0000066c cmpl $9, %edx
0x0f, 0x87, 0x0f, 0x00, 0x00, 0x00, //0x0000066f ja LBB0_21
0x80, 0xc2, 0x30, //0x00000675 addb $48, %dl
0x88, 0x17, //0x00000678 movb %dl, (%rdi)
0xb9, 0x01, 0x00, 0x00, 0x00, //0x0000067a movl $1, %ecx
0xe9, 0x52, 0x00, 0x00, 0x00, //0x0000067f jmp LBB0_24
//0x00000684 LBB0_21
0x83, 0xfa, 0x63, //0x00000684 cmpl $99, %edx
0x0f, 0x87, 0x1a, 0x00, 0x00, 0x00, //0x00000687 ja LBB0_23
0x89, 0xd0, //0x0000068d movl %edx, %eax
0x48, 0x8d, 0x0d, 0x8a, 0x02, 0x00, 0x00, //0x0000068f leaq $650(%rip), %rcx /* _Digits+0(%rip) */
0x0f, 0xb7, 0x04, 0x41, //0x00000696 movzwl (%rcx,%rax,2), %eax
0x66, 0x89, 0x07, //0x0000069a movw %ax, (%rdi)
0xb9, 0x02, 0x00, 0x00, 0x00, //0x0000069d movl $2, %ecx
0xe9, 0x2f, 0x00, 0x00, 0x00, //0x000006a2 jmp LBB0_24
//0x000006a7 LBB0_23
0x89, 0xd0, //0x000006a7 movl %edx, %eax
0xc1, 0xe8, 0x02, //0x000006a9 shrl $2, %eax
0x69, 0xc0, 0x7b, 0x14, 0x00, 0x00, //0x000006ac imull $5243, %eax, %eax
0xc1, 0xe8, 0x11, //0x000006b2 shrl $17, %eax
0x8d, 0x48, 0x30, //0x000006b5 leal $48(%rax), %ecx
0x88, 0x0f, //0x000006b8 movb %cl, (%rdi)
0x6b, 0xc0, 0x64, //0x000006ba imull $100, %eax, %eax
0x29, 0xc2, //0x000006bd subl %eax, %edx
0x0f, 0xb7, 0xc2, //0x000006bf movzwl %dx, %eax
0x48, 0x8d, 0x0d, 0x57, 0x02, 0x00, 0x00, //0x000006c2 leaq $599(%rip), %rcx /* _Digits+0(%rip) */
0x0f, 0xb7, 0x04, 0x41, //0x000006c9 movzwl (%rcx,%rax,2), %eax
0x66, 0x89, 0x47, 0x01, //0x000006cd movw %ax, $1(%rdi)
0xb9, 0x03, 0x00, 0x00, 0x00, //0x000006d1 movl $3, %ecx
//0x000006d6 LBB0_24
0x48, 0xba, 0xfd, 0xce, 0x61, 0x84, 0x11, 0x77, 0xcc, 0xab, //0x000006d6 movabsq $-6067343680855748867, %rdx
0x48, 0x89, 0xf0, //0x000006e0 movq %rsi, %rax
0x48, 0xf7, 0xe2, //0x000006e3 mulq %rdx
0x48, 0xc1, 0xea, 0x1a, //0x000006e6 shrq $26, %rdx
0xc5, 0xf9, 0x6e, 0xc2, //0x000006ea vmovd %edx, %xmm0
0xc5, 0xfa, 0x6f, 0x0d, 0x0a, 0xf9, 0xff, 0xff, //0x000006ee vmovdqu $-1782(%rip), %xmm1 /* LCPI0_0+0(%rip) */
0xc5, 0xf9, 0xf4, 0xd1, //0x000006f6 vpmuludq %xmm1, %xmm0, %xmm2
0xc5, 0xe9, 0x73, 0xd2, 0x2d, //0x000006fa vpsrlq $45, %xmm2, %xmm2
0xb8, 0x10, 0x27, 0x00, 0x00, //0x000006ff movl $10000, %eax
0xc4, 0xe1, 0xf9, 0x6e, 0xd8, //0x00000704 vmovq %rax, %xmm3
0xc5, 0xe9, 0xf4, 0xe3, //0x00000709 vpmuludq %xmm3, %xmm2, %xmm4
0xc5, 0xf9, 0xfa, 0xc4, //0x0000070d vpsubd %xmm4, %xmm0, %xmm0
0xc5, 0xe9, 0x61, 0xc0, //0x00000711 vpunpcklwd %xmm0, %xmm2, %xmm0
0xc5, 0xf9, 0x73, 0xf0, 0x02, //0x00000715 vpsllq $2, %xmm0, %xmm0
0xc5, 0xfb, 0x70, 0xc0, 0x50, //0x0000071a vpshuflw $80, %xmm0, %xmm0
0xc4, 0xe2, 0x79, 0x59, 0x15, 0x08, 0xf9, 0xff, 0xff, //0x0000071f vpbroadcastq $-1784(%rip), %xmm2 /* LCPI0_1+0(%rip) */
0xc5, 0xf9, 0x70, 0xc0, 0x50, //0x00000728 vpshufd $80, %xmm0, %xmm0
0xc5, 0xf9, 0xe4, 0xc2, //0x0000072d vpmulhuw %xmm2, %xmm0, %xmm0
0xc4, 0xe2, 0x79, 0x59, 0x25, 0xfe, 0xf8, 0xff, 0xff, //0x00000731 vpbroadcastq $-1794(%rip), %xmm4 /* LCPI0_2+0(%rip) */
0xc5, 0xf9, 0xe4, 0xc4, //0x0000073a vpmulhuw %xmm4, %xmm0, %xmm0
0xc5, 0xfa, 0x6f, 0x2d, 0xca, 0xf8, 0xff, 0xff, //0x0000073e vmovdqu $-1846(%rip), %xmm5 /* LCPI0_3+0(%rip) */
0xc5, 0xf9, 0xd5, 0xf5, //0x00000746 vpmullw %xmm5, %xmm0, %xmm6
0xc5, 0xc9, 0x73, 0xf6, 0x10, //0x0000074a vpsllq $16, %xmm6, %xmm6
0xc5, 0xf9, 0xf9, 0xc6, //0x0000074f vpsubw %xmm6, %xmm0, %xmm0
0x69, 0xc2, 0x00, 0xe1, 0xf5, 0x05, //0x00000753 imull $100000000, %edx, %eax
0x29, 0xc6, //0x00000759 subl %eax, %esi
0xc5, 0xf9, 0x6e, 0xf6, //0x0000075b vmovd %esi, %xmm6
0xc5, 0xc9, 0xf4, 0xc9, //0x0000075f vpmuludq %xmm1, %xmm6, %xmm1
0xc5, 0xf1, 0x73, 0xd1, 0x2d, //0x00000763 vpsrlq $45, %xmm1, %xmm1
0xc5, 0xf1, 0xf4, 0xdb, //0x00000768 vpmuludq %xmm3, %xmm1, %xmm3
0xc5, 0xc9, 0xfa, 0xdb, //0x0000076c vpsubd %xmm3, %xmm6, %xmm3
0xc5, 0xf1, 0x61, 0xcb, //0x00000770 vpunpcklwd %xmm3, %xmm1, %xmm1
0xc5, 0xf1, 0x73, 0xf1, 0x02, //0x00000774 vpsllq $2, %xmm1, %xmm1
0xc5, 0xfb, 0x70, 0xc9, 0x50, //0x00000779 vpshuflw $80, %xmm1, %xmm1
0xc5, 0xf9, 0x70, 0xc9, 0x50, //0x0000077e vpshufd $80, %xmm1, %xmm1
0xc5, 0xf1, 0xe4, 0xca, //0x00000783 vpmulhuw %xmm2, %xmm1, %xmm1
0xc5, 0xf1, 0xe4, 0xcc, //0x00000787 vpmulhuw %xmm4, %xmm1, %xmm1
0xc5, 0xf1, 0xd5, 0xd5, //0x0000078b vpmullw %xmm5, %xmm1, %xmm2
0xc5, 0xe9, 0x73, 0xf2, 0x10, //0x0000078f vpsllq $16, %xmm2, %xmm2
0xc5, 0xf1, 0xf9, 0xca, //0x00000794 vpsubw %xmm2, %xmm1, %xmm1
0xc5, 0xf9, 0x67, 0xc1, //0x00000798 vpackuswb %xmm1, %xmm0, %xmm0
0xc5, 0xf9, 0xfc, 0x05, 0x7c, 0xf8, 0xff, 0xff, //0x0000079c vpaddb $-1924(%rip), %xmm0, %xmm0 /* LCPI0_4+0(%rip) */
0x89, 0xc8, //0x000007a4 movl %ecx, %eax
0xc5, 0xfa, 0x7f, 0x04, 0x07, //0x000007a6 vmovdqu %xmm0, (%rdi,%rax)
0x83, 0xc9, 0x10, //0x000007ab orl $16, %ecx
0x89, 0xc8, //0x000007ae movl %ecx, %eax
0x5d, //0x000007b0 popq %rbp
0xc3, //0x000007b1 retq
//0x000007b2 LBB0_43
0x48, 0xba, 0x57, 0x78, 0x13, 0xb1, 0x2f, 0x65, 0xa5, 0x39, //0x000007b2 movabsq $4153837486827862103, %rdx
0x48, 0x89, 0xf0, //0x000007bc movq %rsi, %rax
0x48, 0xf7, 0xe2, //0x000007bf mulq %rdx
0x48, 0xc1, 0xea, 0x33, //0x000007c2 shrq $51, %rdx
0x48, 0x0f, 0xaf, 0xca, //0x000007c6 imulq %rdx, %rcx
0x48, 0x29, 0xce, //0x000007ca subq %rcx, %rsi
0x83, 0xfa, 0x09, //0x000007cd cmpl $9, %edx
0x0f, 0x87, 0x10, 0x00, 0x00, 0x00, //0x000007d0 ja LBB0_45
0x80, 0xc2, 0x30, //0x000007d6 addb $48, %dl
0x88, 0x57, 0x01, //0x000007d9 movb %dl, $1(%rdi)
0xb9, 0x01, 0x00, 0x00, 0x00, //0x000007dc movl $1, %ecx
0xe9, 0x54, 0x00, 0x00, 0x00, //0x000007e1 jmp LBB0_48
//0x000007e6 LBB0_45
0x83, 0xfa, 0x63, //0x000007e6 cmpl $99, %edx
0x0f, 0x87, 0x1b, 0x00, 0x00, 0x00, //0x000007e9 ja LBB0_47
0x89, 0xd0, //0x000007ef movl %edx, %eax
0x48, 0x8d, 0x0d, 0x28, 0x01, 0x00, 0x00, //0x000007f1 leaq $296(%rip), %rcx /* _Digits+0(%rip) */
0x0f, 0xb7, 0x04, 0x41, //0x000007f8 movzwl (%rcx,%rax,2), %eax
0x66, 0x89, 0x47, 0x01, //0x000007fc movw %ax, $1(%rdi)
0xb9, 0x02, 0x00, 0x00, 0x00, //0x00000800 movl $2, %ecx
0xe9, 0x30, 0x00, 0x00, 0x00, //0x00000805 jmp LBB0_48
//0x0000080a LBB0_47
0x89, 0xd0, //0x0000080a movl %edx, %eax
0xc1, 0xe8, 0x02, //0x0000080c shrl $2, %eax
0x69, 0xc0, 0x7b, 0x14, 0x00, 0x00, //0x0000080f imull $5243, %eax, %eax
0xc1, 0xe8, 0x11, //0x00000815 shrl $17, %eax
0x8d, 0x48, 0x30, //0x00000818 leal $48(%rax), %ecx
0x88, 0x4f, 0x01, //0x0000081b movb %cl, $1(%rdi)
0x6b, 0xc0, 0x64, //0x0000081e imull $100, %eax, %eax
0x29, 0xc2, //0x00000821 subl %eax, %edx
0x0f, 0xb7, 0xc2, //0x00000823 movzwl %dx, %eax
0x48, 0x8d, 0x0d, 0xf3, 0x00, 0x00, 0x00, //0x00000826 leaq $243(%rip), %rcx /* _Digits+0(%rip) */
0x0f, 0xb7, 0x04, 0x41, //0x0000082d movzwl (%rcx,%rax,2), %eax
0x66, 0x89, 0x47, 0x02, //0x00000831 movw %ax, $2(%rdi)
0xb9, 0x03, 0x00, 0x00, 0x00, //0x00000835 movl $3, %ecx
//0x0000083a LBB0_48
0x48, 0xba, 0xfd, 0xce, 0x61, 0x84, 0x11, 0x77, 0xcc, 0xab, //0x0000083a movabsq $-6067343680855748867, %rdx
0x48, 0x89, 0xf0, //0x00000844 movq %rsi, %rax
0x48, 0xf7, 0xe2, //0x00000847 mulq %rdx
0x48, 0xc1, 0xea, 0x1a, //0x0000084a shrq $26, %rdx
0xc5, 0xf9, 0x6e, 0xc2, //0x0000084e vmovd %edx, %xmm0
0xc5, 0xfa, 0x6f, 0x0d, 0xa6, 0xf7, 0xff, 0xff, //0x00000852 vmovdqu $-2138(%rip), %xmm1 /* LCPI0_0+0(%rip) */
0xc5, 0xf9, 0xf4, 0xd1, //0x0000085a vpmuludq %xmm1, %xmm0, %xmm2
0xc5, 0xe9, 0x73, 0xd2, 0x2d, //0x0000085e vpsrlq $45, %xmm2, %xmm2
0xb8, 0x10, 0x27, 0x00, 0x00, //0x00000863 movl $10000, %eax
0xc4, 0xe1, 0xf9, 0x6e, 0xd8, //0x00000868 vmovq %rax, %xmm3
0xc5, 0xe9, 0xf4, 0xe3, //0x0000086d vpmuludq %xmm3, %xmm2, %xmm4
0xc5, 0xf9, 0xfa, 0xc4, //0x00000871 vpsubd %xmm4, %xmm0, %xmm0
0xc5, 0xe9, 0x61, 0xc0, //0x00000875 vpunpcklwd %xmm0, %xmm2, %xmm0
0xc5, 0xf9, 0x73, 0xf0, 0x02, //0x00000879 vpsllq $2, %xmm0, %xmm0
0xc5, 0xfb, 0x70, 0xc0, 0x50, //0x0000087e vpshuflw $80, %xmm0, %xmm0
0xc4, 0xe2, 0x79, 0x59, 0x15, 0xa4, 0xf7, 0xff, 0xff, //0x00000883 vpbroadcastq $-2140(%rip), %xmm2 /* LCPI0_1+0(%rip) */
0xc5, 0xf9, 0x70, 0xc0, 0x50, //0x0000088c vpshufd $80, %xmm0, %xmm0
0xc5, 0xf9, 0xe4, 0xc2, //0x00000891 vpmulhuw %xmm2, %xmm0, %xmm0
0xc4, 0xe2, 0x79, 0x59, 0x25, 0x9a, 0xf7, 0xff, 0xff, //0x00000895 vpbroadcastq $-2150(%rip), %xmm4 /* LCPI0_2+0(%rip) */
0xc5, 0xf9, 0xe4, 0xc4, //0x0000089e vpmulhuw %xmm4, %xmm0, %xmm0
0xc5, 0xfa, 0x6f, 0x2d, 0x66, 0xf7, 0xff, 0xff, //0x000008a2 vmovdqu $-2202(%rip), %xmm5 /* LCPI0_3+0(%rip) */
0xc5, 0xf9, 0xd5, 0xf5, //0x000008aa vpmullw %xmm5, %xmm0, %xmm6
0xc5, 0xc9, 0x73, 0xf6, 0x10, //0x000008ae vpsllq $16, %xmm6, %xmm6
0xc5, 0xf9, 0xf9, 0xc6, //0x000008b3 vpsubw %xmm6, %xmm0, %xmm0
0x69, 0xc2, 0x00, 0xe1, 0xf5, 0x05, //0x000008b7 imull $100000000, %edx, %eax
0x29, 0xc6, //0x000008bd subl %eax, %esi
0xc5, 0xf9, 0x6e, 0xf6, //0x000008bf vmovd %esi, %xmm6
0xc5, 0xc9, 0xf4, 0xc9, //0x000008c3 vpmuludq %xmm1, %xmm6, %xmm1
0xc5, 0xf1, 0x73, 0xd1, 0x2d, //0x000008c7 vpsrlq $45, %xmm1, %xmm1
0xc5, 0xf1, 0xf4, 0xdb, //0x000008cc vpmuludq %xmm3, %xmm1, %xmm3
0xc5, 0xc9, 0xfa, 0xdb, //0x000008d0 vpsubd %xmm3, %xmm6, %xmm3
0xc5, 0xf1, 0x61, 0xcb, //0x000008d4 vpunpcklwd %xmm3, %xmm1, %xmm1
0xc5, 0xf1, 0x73, 0xf1, 0x02, //0x000008d8 vpsllq $2, %xmm1, %xmm1
0xc5, 0xfb, 0x70, 0xc9, 0x50, //0x000008dd vpshuflw $80, %xmm1, %xmm1
0xc5, 0xf9, 0x70, 0xc9, 0x50, //0x000008e2 vpshufd $80, %xmm1, %xmm1
0xc5, 0xf1, 0xe4, 0xca, //0x000008e7 vpmulhuw %xmm2, %xmm1, %xmm1
0xc5, 0xf1, 0xe4, 0xcc, //0x000008eb vpmulhuw %xmm4, %xmm1, %xmm1
0xc5, 0xf1, 0xd5, 0xd5, //0x000008ef vpmullw %xmm5, %xmm1, %xmm2
0xc5, 0xe9, 0x73, 0xf2, 0x10, //0x000008f3 vpsllq $16, %xmm2, %xmm2
0xc5, 0xf1, 0xf9, 0xca, //0x000008f8 vpsubw %xmm2, %xmm1, %xmm1
0xc5, 0xf9, 0x67, 0xc1, //0x000008fc vpackuswb %xmm1, %xmm0, %xmm0
0xc5, 0xf9, 0xfc, 0x05, 0x18, 0xf7, 0xff, 0xff, //0x00000900 vpaddb $-2280(%rip), %xmm0, %xmm0 /* LCPI0_4+0(%rip) */
0x89, 0xc8, //0x00000908 movl %ecx, %eax
0xc5, 0xfa, 0x7f, 0x44, 0x07, 0x01, //0x0000090a vmovdqu %xmm0, $1(%rdi,%rax)
0x83, 0xc9, 0x10, //0x00000910 orl $16, %ecx
0x83, 0xc1, 0x01, //0x00000913 addl $1, %ecx
0x89, 0xc8, //0x00000916 movl %ecx, %eax
0x5d, //0x00000918 popq %rbp
0xc3, //0x00000919 retq
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x0000091a .p2align 4, 0x00
//0x00000920 _Digits
0x30, 0x30, 0x30, 0x31, 0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x30, 0x35, 0x30, 0x36, 0x30, 0x37, //0x00000920 QUAD $0x3330323031303030; QUAD $0x3730363035303430 // .ascii 16, '0001020304050607'
0x30, 0x38, 0x30, 0x39, 0x31, 0x30, 0x31, 0x31, 0x31, 0x32, 0x31, 0x33, 0x31, 0x34, 0x31, 0x35, //0x00000930 QUAD $0x3131303139303830; QUAD $0x3531343133313231 // .ascii 16, '0809101112131415'
0x31, 0x36, 0x31, 0x37, 0x31, 0x38, 0x31, 0x39, 0x32, 0x30, 0x32, 0x31, 0x32, 0x32, 0x32, 0x33, //0x00000940 QUAD $0x3931383137313631; QUAD $0x3332323231323032 // .ascii 16, '1617181920212223'
0x32, 0x34, 0x32, 0x35, 0x32, 0x36, 0x32, 0x37, 0x32, 0x38, 0x32, 0x39, 0x33, 0x30, 0x33, 0x31, //0x00000950 QUAD $0x3732363235323432; QUAD $0x3133303339323832 // .ascii 16, '2425262728293031'
0x33, 0x32, 0x33, 0x33, 0x33, 0x34, 0x33, 0x35, 0x33, 0x36, 0x33, 0x37, 0x33, 0x38, 0x33, 0x39, //0x00000960 QUAD $0x3533343333333233; QUAD $0x3933383337333633 // .ascii 16, '3233343536373839'
0x34, 0x30, 0x34, 0x31, 0x34, 0x32, 0x34, 0x33, 0x34, 0x34, 0x34, 0x35, 0x34, 0x36, 0x34, 0x37, //0x00000970 QUAD $0x3334323431343034; QUAD $0x3734363435343434 // .ascii 16, '4041424344454647'
0x34, 0x38, 0x34, 0x39, 0x35, 0x30, 0x35, 0x31, 0x35, 0x32, 0x35, 0x33, 0x35, 0x34, 0x35, 0x35, //0x00000980 QUAD $0x3135303539343834; QUAD $0x3535343533353235 // .ascii 16, '4849505152535455'
0x35, 0x36, 0x35, 0x37, 0x35, 0x38, 0x35, 0x39, 0x36, 0x30, 0x36, 0x31, 0x36, 0x32, 0x36, 0x33, //0x00000990 QUAD $0x3935383537353635; QUAD $0x3336323631363036 // .ascii 16, '5657585960616263'
0x36, 0x34, 0x36, 0x35, 0x36, 0x36, 0x36, 0x37, 0x36, 0x38, 0x36, 0x39, 0x37, 0x30, 0x37, 0x31, //0x000009a0 QUAD $0x3736363635363436; QUAD $0x3137303739363836 // .ascii 16, '6465666768697071'
0x37, 0x32, 0x37, 0x33, 0x37, 0x34, 0x37, 0x35, 0x37, 0x36, 0x37, 0x37, 0x37, 0x38, 0x37, 0x39, //0x000009b0 QUAD $0x3537343733373237; QUAD $0x3937383737373637 // .ascii 16, '7273747576777879'
0x38, 0x30, 0x38, 0x31, 0x38, 0x32, 0x38, 0x33, 0x38, 0x34, 0x38, 0x35, 0x38, 0x36, 0x38, 0x37, //0x000009c0 QUAD $0x3338323831383038; QUAD $0x3738363835383438 // .ascii 16, '8081828384858687'
0x38, 0x38, 0x38, 0x39, 0x39, 0x30, 0x39, 0x31, 0x39, 0x32, 0x39, 0x33, 0x39, 0x34, 0x39, 0x35, //0x000009d0 QUAD $0x3139303939383838; QUAD $0x3539343933393239 // .ascii 16, '8889909192939495'
0x39, 0x36, 0x39, 0x37, 0x39, 0x38, 0x39, 0x39, //0x000009e0 QUAD $0x3939383937393639 // .ascii 8, '96979899'
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //0x000009e8 .p2align 4, 0x00
//0x000009f0 _VecShiftShuffles
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, //0x000009f0 QUAD $0x0706050403020100; QUAD $0x0f0e0d0c0b0a0908 // .ascii 16, '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f'
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0xff, //0x00000a00 QUAD $0x0807060504030201; QUAD $0xff0f0e0d0c0b0a09 // .ascii 16, '\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff'
0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0xff, 0xff, //0x00000a10 QUAD $0x0908070605040302; QUAD $0xffff0f0e0d0c0b0a // .ascii 16, '\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff'
0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0xff, 0xff, 0xff, //0x00000a20 QUAD $0x0a09080706050403; QUAD $0xffffff0f0e0d0c0b // .ascii 16, '\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff\xff'
0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0xff, 0xff, 0xff, 0xff, //0x00000a30 QUAD $0x0b0a090807060504; QUAD $0xffffffff0f0e0d0c // .ascii 16, '\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff\xff\xff'
0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, //0x00000a40 QUAD $0x0c0b0a0908070605; QUAD $0xffffffffff0f0e0d // .ascii 16, '\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff\xff\xff\xff'
0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //0x00000a50 QUAD $0x0d0c0b0a09080706; QUAD $0xffffffffffff0f0e // .ascii 16, '\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff\xff\xff\xff\xff'
0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //0x00000a60 QUAD $0x0e0d0c0b0a090807; QUAD $0xffffffffffffff0f // .ascii 16, '\x07\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff\xff\xff\xff\xff\xff'
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, //0x00000a70 QUAD $0x0f0e0d0c0b0a0908; QUAD $0xffffffffffffffff // .ascii 16, '\x08\t\n\x0b\x0c\r\x0e\x0f\xff\xff\xff\xff\xff\xff\xff\xff'
}

View File

@@ -0,0 +1,37 @@
// Code generated by scripts, DO NOT EDIT.
// Code generated by scripts, DO NOT EDIT.
/*
* 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 avx2
import (
`unsafe`
`github.com/bytedance/sonic/internal/rt`
)
var F_lookup_small_key func(key unsafe.Pointer, table unsafe.Pointer, lowerOff int) (ret int)
var S_lookup_small_key uintptr
//go:nosplit
func lookup_small_key(key *string, table *[]byte, lowerOff int) (ret int) {
return F_lookup_small_key(rt.NoEscape(unsafe.Pointer(key)), rt.NoEscape(unsafe.Pointer(table)), lowerOff)
}

View File

@@ -0,0 +1,46 @@
// +build !noasm !appengine
// Code generated by asm2asm, DO NOT EDIT.
package avx2
import (
`github.com/bytedance/sonic/loader`
)
const (
_entry__lookup_small_key = 96
)
const (
_stack__lookup_small_key = 56
)
const (
_size__lookup_small_key = 810
)
var (
_pcsp__lookup_small_key = [][2]uint32{
{0x1, 0},
{0x6, 8},
{0x8, 16},
{0xa, 24},
{0xc, 32},
{0xd, 40},
{0xe, 48},
{0x2fc, 56},
{0x2fd, 48},
{0x2ff, 40},
{0x301, 32},
{0x303, 24},
{0x305, 16},
{0x306, 8},
{0x30a, 0},
{0x32a, 56},
}
)
var _cfunc_lookup_small_key = []loader.CFunc{
{"_lookup_small_key_entry", 0, _entry__lookup_small_key, 0, nil},
{"_lookup_small_key", _entry__lookup_small_key, _size__lookup_small_key, _stack__lookup_small_key, _pcsp__lookup_small_key},
}

View File

@@ -0,0 +1,221 @@
// +build amd64
// Code generated by asm2asm, DO NOT EDIT.
package avx2
var _text_lookup_small_key = []byte{
// .p2align 5, 0x00
// LCPI0_0
0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, // QUAD $0x4040404040404040; QUAD $0x4040404040404040 // .space 16, '@@@@@@@@@@@@@@@@'
0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, //0x00000010 QUAD $0x4040404040404040; QUAD $0x4040404040404040 // .space 16, '@@@@@@@@@@@@@@@@'
//0x00000020 LCPI0_1
0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, //0x00000020 QUAD $0x5a5a5a5a5a5a5a5a; QUAD $0x5a5a5a5a5a5a5a5a // .space 16, 'ZZZZZZZZZZZZZZZZ'
0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, //0x00000030 QUAD $0x5a5a5a5a5a5a5a5a; QUAD $0x5a5a5a5a5a5a5a5a // .space 16, 'ZZZZZZZZZZZZZZZZ'
//0x00000040 LCPI0_2
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, //0x00000040 QUAD $0x0101010101010101; QUAD $0x0101010101010101 // .space 16, '\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01'
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, //0x00000050 QUAD $0x0101010101010101; QUAD $0x0101010101010101 // .space 16, '\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01'
//0x00000060 .p2align 4, 0x90
//0x00000060 _lookup_small_key
0x55, //0x00000060 pushq %rbp
0x48, 0x89, 0xe5, //0x00000061 movq %rsp, %rbp
0x41, 0x57, //0x00000064 pushq %r15
0x41, 0x56, //0x00000066 pushq %r14
0x41, 0x55, //0x00000068 pushq %r13
0x41, 0x54, //0x0000006a pushq %r12
0x53, //0x0000006c pushq %rbx
0x50, //0x0000006d pushq %rax
0x4c, 0x8b, 0x57, 0x08, //0x0000006e movq $8(%rdi), %r10
0x4c, 0x8b, 0x2e, //0x00000072 movq (%rsi), %r13
0x45, 0x0f, 0xb6, 0xc2, //0x00000075 movzbl %r10b, %r8d
0x4b, 0x8d, 0x0c, 0x80, //0x00000079 leaq (%r8,%r8,4), %rcx
0x45, 0x0f, 0xb6, 0x4c, 0x0d, 0x00, //0x0000007d movzbl (%r13,%rcx), %r9d
0x48, 0xc7, 0xc0, 0xff, 0xff, 0xff, 0xff, //0x00000083 movq $-1, %rax
0x45, 0x85, 0xc9, //0x0000008a testl %r9d, %r9d
0x0f, 0x84, 0xc5, 0x02, 0x00, 0x00, //0x0000008d je LBB0_40
0x4c, 0x8b, 0x1f, //0x00000093 movq (%rdi), %r11
0x41, 0x8b, 0x44, 0x0d, 0x01, //0x00000096 movl $1(%r13,%rcx), %eax
0x8d, 0xb8, 0xa5, 0x00, 0x00, 0x00, //0x0000009b leal $165(%rax), %edi
0x4c, 0x01, 0xef, //0x000000a1 addq %r13, %rdi
0x41, 0x0f, 0xb6, 0xca, //0x000000a4 movzbl %r10b, %ecx
0x41, 0x83, 0xf8, 0x09, //0x000000a8 cmpl $9, %r8d
0x48, 0x89, 0x45, 0xd0, //0x000000ac movq %rax, $-48(%rbp)
0x0f, 0x83, 0xc6, 0x00, 0x00, 0x00, //0x000000b0 jae LBB0_2
0x45, 0x8a, 0x3b, //0x000000b6 movb (%r11), %r15b
0x45, 0x8d, 0x60, 0x01, //0x000000b9 leal $1(%r8), %r12d
0x44, 0x89, 0xcb, //0x000000bd movl %r9d, %ebx
//0x000000c0 .p2align 4, 0x90
//0x000000c0 LBB0_7
0x44, 0x38, 0x3f, //0x000000c0 cmpb %r15b, (%rdi)
0x0f, 0x85, 0x97, 0x00, 0x00, 0x00, //0x000000c3 jne LBB0_8
0x44, 0x0f, 0xb6, 0x77, 0x01, //0x000000c9 movzbl $1(%rdi), %r14d
0xbe, 0x01, 0x00, 0x00, 0x00, //0x000000ce movl $1, %esi
0x45, 0x3a, 0x73, 0x01, //0x000000d3 cmpb $1(%r11), %r14b
0x0f, 0x85, 0x85, 0x00, 0x00, 0x00, //0x000000d7 jne LBB0_16
0x0f, 0xb6, 0x47, 0x02, //0x000000dd movzbl $2(%rdi), %eax
0xbe, 0x02, 0x00, 0x00, 0x00, //0x000000e1 movl $2, %esi
0x41, 0x3a, 0x43, 0x02, //0x000000e6 cmpb $2(%r11), %al
0x0f, 0x85, 0x72, 0x00, 0x00, 0x00, //0x000000ea jne LBB0_16
0x0f, 0xb6, 0x47, 0x03, //0x000000f0 movzbl $3(%rdi), %eax
0xbe, 0x03, 0x00, 0x00, 0x00, //0x000000f4 movl $3, %esi
0x41, 0x3a, 0x43, 0x03, //0x000000f9 cmpb $3(%r11), %al
0x0f, 0x85, 0x5f, 0x00, 0x00, 0x00, //0x000000fd jne LBB0_16
0x0f, 0xb6, 0x47, 0x04, //0x00000103 movzbl $4(%rdi), %eax
0xbe, 0x04, 0x00, 0x00, 0x00, //0x00000107 movl $4, %esi
0x41, 0x3a, 0x43, 0x04, //0x0000010c cmpb $4(%r11), %al
0x0f, 0x85, 0x4c, 0x00, 0x00, 0x00, //0x00000110 jne LBB0_16
0x0f, 0xb6, 0x47, 0x05, //0x00000116 movzbl $5(%rdi), %eax
0xbe, 0x05, 0x00, 0x00, 0x00, //0x0000011a movl $5, %esi
0x41, 0x3a, 0x43, 0x05, //0x0000011f cmpb $5(%r11), %al
0x0f, 0x85, 0x39, 0x00, 0x00, 0x00, //0x00000123 jne LBB0_16
0x0f, 0xb6, 0x47, 0x06, //0x00000129 movzbl $6(%rdi), %eax
0xbe, 0x06, 0x00, 0x00, 0x00, //0x0000012d movl $6, %esi
0x41, 0x3a, 0x43, 0x06, //0x00000132 cmpb $6(%r11), %al
0x0f, 0x85, 0x26, 0x00, 0x00, 0x00, //0x00000136 jne LBB0_16
0x0f, 0xb6, 0x47, 0x07, //0x0000013c movzbl $7(%rdi), %eax
0x31, 0xf6, //0x00000140 xorl %esi, %esi
0x41, 0x3a, 0x43, 0x07, //0x00000142 cmpb $7(%r11), %al
0x40, 0x0f, 0x94, 0xc6, //0x00000146 sete %sil
0x48, 0x83, 0xc6, 0x07, //0x0000014a addq $7, %rsi
0xe9, 0x0f, 0x00, 0x00, 0x00, //0x0000014e jmp LBB0_16
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, //0x00000153 .p2align 4, 0x90
//0x00000160 LBB0_8
0x31, 0xf6, //0x00000160 xorl %esi, %esi
//0x00000162 LBB0_16
0x48, 0x39, 0xce, //0x00000162 cmpq %rcx, %rsi
0x0f, 0x83, 0x81, 0x01, 0x00, 0x00, //0x00000165 jae LBB0_17
0x4c, 0x01, 0xe7, //0x0000016b addq %r12, %rdi
0x83, 0xc3, 0xff, //0x0000016e addl $-1, %ebx
0x0f, 0x85, 0x49, 0xff, 0xff, 0xff, //0x00000171 jne LBB0_7
0xe9, 0x43, 0x00, 0x00, 0x00, //0x00000177 jmp LBB0_20
//0x0000017c LBB0_2
0xc4, 0xc1, 0x7e, 0x6f, 0x03, //0x0000017c vmovdqu (%r11), %ymm0
0x48, 0xc7, 0xc6, 0xff, 0xff, 0xff, 0xff, //0x00000181 movq $-1, %rsi
0x48, 0xd3, 0xe6, //0x00000188 shlq %cl, %rsi
0x45, 0x8d, 0x78, 0x01, //0x0000018b leal $1(%r8), %r15d
0x44, 0x89, 0xcb, //0x0000018f movl %r9d, %ebx
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, //0x00000192 .p2align 4, 0x90
//0x000001a0 LBB0_3
0xc5, 0xfd, 0x74, 0x0f, //0x000001a0 vpcmpeqb (%rdi), %ymm0, %ymm1
0xc5, 0xfd, 0xd7, 0xc1, //0x000001a4 vpmovmskb %ymm1, %eax
0x09, 0xf0, //0x000001a8 orl %esi, %eax
0x83, 0xf8, 0xff, //0x000001aa cmpl $-1, %eax
0x0f, 0x84, 0x48, 0x01, 0x00, 0x00, //0x000001ad je LBB0_4
0x4c, 0x01, 0xff, //0x000001b3 addq %r15, %rdi
0x83, 0xc3, 0xff, //0x000001b6 addl $-1, %ebx
0x0f, 0x85, 0xe1, 0xff, 0xff, 0xff, //0x000001b9 jne LBB0_3
//0x000001bf LBB0_20
0x48, 0x83, 0xfa, 0xff, //0x000001bf cmpq $-1, %rdx
0x0f, 0x84, 0x88, 0x01, 0x00, 0x00, //0x000001c3 je LBB0_39
0x48, 0x8b, 0x45, 0xd0, //0x000001c9 movq $-48(%rbp), %rax
0x48, 0x01, 0xd0, //0x000001cd addq %rdx, %rax
0x49, 0x01, 0xc5, //0x000001d0 addq %rax, %r13
0xc4, 0xc1, 0x7e, 0x6f, 0x03, //0x000001d3 vmovdqu (%r11), %ymm0
0xc5, 0xfd, 0x64, 0x0d, 0x20, 0xfe, 0xff, 0xff, //0x000001d8 vpcmpgtb $-480(%rip), %ymm0, %ymm1 /* LCPI0_0+0(%rip) */
0xc5, 0xfe, 0x6f, 0x15, 0x38, 0xfe, 0xff, 0xff, //0x000001e0 vmovdqu $-456(%rip), %ymm2 /* LCPI0_1+0(%rip) */
0xc5, 0xed, 0x64, 0xd0, //0x000001e8 vpcmpgtb %ymm0, %ymm2, %ymm2
0xc5, 0xed, 0xdb, 0xc9, //0x000001ec vpand %ymm1, %ymm2, %ymm1
0xc5, 0xf5, 0xdb, 0x0d, 0x48, 0xfe, 0xff, 0xff, //0x000001f0 vpand $-440(%rip), %ymm1, %ymm1 /* LCPI0_2+0(%rip) */
0xc5, 0xf5, 0x71, 0xf1, 0x05, //0x000001f8 vpsllw $5, %ymm1, %ymm1
0xc5, 0xf5, 0xfc, 0xc0, //0x000001fd vpaddb %ymm0, %ymm1, %ymm0
0x41, 0x0f, 0xb6, 0xca, //0x00000201 movzbl %r10b, %ecx
0x41, 0x83, 0xf8, 0x09, //0x00000205 cmpl $9, %r8d
0x0f, 0x83, 0xf7, 0x00, 0x00, 0x00, //0x00000209 jae LBB0_22
0xc4, 0xe3, 0x79, 0x14, 0xc2, 0x01, //0x0000020f vpextrb $1, %xmm0, %edx
0xc4, 0xc3, 0x79, 0x14, 0xc4, 0x02, //0x00000215 vpextrb $2, %xmm0, %r12d
0xc4, 0xc3, 0x79, 0x14, 0xc7, 0x03, //0x0000021b vpextrb $3, %xmm0, %r15d
0xc4, 0xc3, 0x79, 0x14, 0xc2, 0x04, //0x00000221 vpextrb $4, %xmm0, %r10d
0xc4, 0xc3, 0x79, 0x14, 0xc3, 0x05, //0x00000227 vpextrb $5, %xmm0, %r11d
0xc4, 0xc3, 0x79, 0x14, 0xc6, 0x06, //0x0000022d vpextrb $6, %xmm0, %r14d
0xc5, 0xf9, 0x7e, 0xc3, //0x00000233 vmovd %xmm0, %ebx
0xc4, 0xe3, 0x79, 0x14, 0xc0, 0x07, //0x00000237 vpextrb $7, %xmm0, %eax
0x41, 0x83, 0xc0, 0x01, //0x0000023d addl $1, %r8d
0x41, 0x83, 0xf9, 0x02, //0x00000241 cmpl $2, %r9d
0xbf, 0x01, 0x00, 0x00, 0x00, //0x00000245 movl $1, %edi
0x41, 0x0f, 0x43, 0xf9, //0x0000024a cmovael %r9d, %edi
0x90, 0x90, //0x0000024e .p2align 4, 0x90
//0x00000250 LBB0_26
0x41, 0x38, 0x5d, 0x00, //0x00000250 cmpb %bl, (%r13)
0x0f, 0x85, 0x76, 0x00, 0x00, 0x00, //0x00000254 jne LBB0_27
0xbe, 0x01, 0x00, 0x00, 0x00, //0x0000025a movl $1, %esi
0x41, 0x38, 0x55, 0x01, //0x0000025f cmpb %dl, $1(%r13)
0x0f, 0x85, 0x69, 0x00, 0x00, 0x00, //0x00000263 jne LBB0_35
0xbe, 0x02, 0x00, 0x00, 0x00, //0x00000269 movl $2, %esi
0x45, 0x38, 0x65, 0x02, //0x0000026e cmpb %r12b, $2(%r13)
0x0f, 0x85, 0x5a, 0x00, 0x00, 0x00, //0x00000272 jne LBB0_35
0xbe, 0x03, 0x00, 0x00, 0x00, //0x00000278 movl $3, %esi
0x45, 0x38, 0x7d, 0x03, //0x0000027d cmpb %r15b, $3(%r13)
0x0f, 0x85, 0x4b, 0x00, 0x00, 0x00, //0x00000281 jne LBB0_35
0xbe, 0x04, 0x00, 0x00, 0x00, //0x00000287 movl $4, %esi
0x45, 0x38, 0x55, 0x04, //0x0000028c cmpb %r10b, $4(%r13)
0x0f, 0x85, 0x3c, 0x00, 0x00, 0x00, //0x00000290 jne LBB0_35
0xbe, 0x05, 0x00, 0x00, 0x00, //0x00000296 movl $5, %esi
0x45, 0x38, 0x5d, 0x05, //0x0000029b cmpb %r11b, $5(%r13)
0x0f, 0x85, 0x2d, 0x00, 0x00, 0x00, //0x0000029f jne LBB0_35
0xbe, 0x06, 0x00, 0x00, 0x00, //0x000002a5 movl $6, %esi
0x45, 0x38, 0x75, 0x06, //0x000002aa cmpb %r14b, $6(%r13)
0x0f, 0x85, 0x1e, 0x00, 0x00, 0x00, //0x000002ae jne LBB0_35
0x31, 0xf6, //0x000002b4 xorl %esi, %esi
0x41, 0x38, 0x45, 0x07, //0x000002b6 cmpb %al, $7(%r13)
0x40, 0x0f, 0x94, 0xc6, //0x000002ba sete %sil
0x48, 0x83, 0xc6, 0x07, //0x000002be addq $7, %rsi
0xe9, 0x0b, 0x00, 0x00, 0x00, //0x000002c2 jmp LBB0_35
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, //0x000002c7 .p2align 4, 0x90
//0x000002d0 LBB0_27
0x31, 0xf6, //0x000002d0 xorl %esi, %esi
//0x000002d2 LBB0_35
0x48, 0x39, 0xce, //0x000002d2 cmpq %rcx, %rsi
0x0f, 0x83, 0x8f, 0x00, 0x00, 0x00, //0x000002d5 jae LBB0_36
0x4d, 0x01, 0xc5, //0x000002db addq %r8, %r13
0x83, 0xc7, 0xff, //0x000002de addl $-1, %edi
0x0f, 0x85, 0x69, 0xff, 0xff, 0xff, //0x000002e1 jne LBB0_26
0xe9, 0x65, 0x00, 0x00, 0x00, //0x000002e7 jmp LBB0_39
//0x000002ec LBB0_17
0x4c, 0x01, 0xe7, //0x000002ec addq %r12, %rdi
0x48, 0x83, 0xc7, 0xff, //0x000002ef addq $-1, %rdi
0x0f, 0xb6, 0x07, //0x000002f3 movzbl (%rdi), %eax
0xe9, 0x5d, 0x00, 0x00, 0x00, //0x000002f6 jmp LBB0_40
//0x000002fb LBB0_4
0x48, 0x01, 0xcf, //0x000002fb addq %rcx, %rdi
0x0f, 0xb6, 0x07, //0x000002fe movzbl (%rdi), %eax
0xe9, 0x52, 0x00, 0x00, 0x00, //0x00000301 jmp LBB0_40
//0x00000306 LBB0_22
0x48, 0xc7, 0xc0, 0xff, 0xff, 0xff, 0xff, //0x00000306 movq $-1, %rax
0x48, 0xd3, 0xe0, //0x0000030d shlq %cl, %rax
0x41, 0x83, 0xc0, 0x01, //0x00000310 addl $1, %r8d
0x41, 0x83, 0xf9, 0x02, //0x00000314 cmpl $2, %r9d
0xba, 0x01, 0x00, 0x00, 0x00, //0x00000318 movl $1, %edx
0x41, 0x0f, 0x43, 0xd1, //0x0000031d cmovael %r9d, %edx
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, //0x00000321 .p2align 4, 0x90
//0x00000330 LBB0_23
0xc4, 0xc1, 0x7d, 0x74, 0x4d, 0x00, //0x00000330 vpcmpeqb (%r13), %ymm0, %ymm1
0xc5, 0xfd, 0xd7, 0xf1, //0x00000336 vpmovmskb %ymm1, %esi
0x09, 0xc6, //0x0000033a orl %eax, %esi
0x83, 0xfe, 0xff, //0x0000033c cmpl $-1, %esi
0x0f, 0x84, 0x35, 0x00, 0x00, 0x00, //0x0000033f je LBB0_24
0x4d, 0x01, 0xc5, //0x00000345 addq %r8, %r13
0x83, 0xc2, 0xff, //0x00000348 addl $-1, %edx
0x0f, 0x85, 0xdf, 0xff, 0xff, 0xff, //0x0000034b jne LBB0_23
//0x00000351 LBB0_39
0x48, 0xc7, 0xc0, 0xff, 0xff, 0xff, 0xff, //0x00000351 movq $-1, %rax
//0x00000358 LBB0_40
0x48, 0x83, 0xc4, 0x08, //0x00000358 addq $8, %rsp
0x5b, //0x0000035c popq %rbx
0x41, 0x5c, //0x0000035d popq %r12
0x41, 0x5d, //0x0000035f popq %r13
0x41, 0x5e, //0x00000361 popq %r14
0x41, 0x5f, //0x00000363 popq %r15
0x5d, //0x00000365 popq %rbp
0xc5, 0xf8, 0x77, //0x00000366 vzeroupper
0xc3, //0x00000369 retq
//0x0000036a LBB0_36
0x4b, 0x8d, 0x3c, 0x28, //0x0000036a leaq (%r8,%r13), %rdi
0x48, 0x83, 0xc7, 0xff, //0x0000036e addq $-1, %rdi
0x0f, 0xb6, 0x07, //0x00000372 movzbl (%rdi), %eax
0xe9, 0xde, 0xff, 0xff, 0xff, //0x00000375 jmp LBB0_40
//0x0000037a LBB0_24
0x49, 0x01, 0xcd, //0x0000037a addq %rcx, %r13
0x4c, 0x89, 0xef, //0x0000037d movq %r13, %rdi
0x41, 0x0f, 0xb6, 0x45, 0x00, //0x00000380 movzbl (%r13), %eax
0xe9, 0xce, 0xff, 0xff, 0xff, //0x00000385 jmp LBB0_40
}

View File

@@ -0,0 +1,35 @@
// Code generated by scripts, DO NOT EDIT.
/*
* 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 avx2
import (
`unsafe`
`github.com/bytedance/sonic/internal/rt`
)
var F_lspace func(sp unsafe.Pointer, nb int, off int) (ret int)
var S_lspace uintptr
//go:nosplit
func lspace(sp *byte, nb int, off int) (ret int) {
return F_lspace(rt.NoEscape(unsafe.Pointer(sp)), nb, off)
}

View File

@@ -0,0 +1,38 @@
// +build !noasm !appengine
// Code generated by asm2asm, DO NOT EDIT.
package avx2
import (
`github.com/bytedance/sonic/loader`
)
const (
_entry__lspace = 32
)
const (
_stack__lspace = 8
)
const (
_size__lspace = 232
)
var (
_pcsp__lspace = [][2]uint32{
{0x1, 0},
{0xbb, 8},
{0xbf, 0},
{0xc8, 8},
{0xcc, 0},
{0xd3, 8},
{0xd7, 0},
{0xe8, 8},
}
)
var _cfunc_lspace = []loader.CFunc{
{"_lspace_entry", 0, _entry__lspace, 0, nil},
{"_lspace", _entry__lspace, _size__lspace, _stack__lspace, _pcsp__lspace},
}

View File

@@ -0,0 +1,112 @@
// +build amd64
// Code generated by asm2asm, DO NOT EDIT.
package avx2
var _text_lspace = []byte{
// .p2align 5, 0x00
// LCPI0_0
0x20, // .byte 32
0x00, //0x00000001 .byte 0
0x00, //0x00000002 .byte 0
0x00, //0x00000003 .byte 0
0x00, //0x00000004 .byte 0
0x00, //0x00000005 .byte 0
0x00, //0x00000006 .byte 0
0x00, //0x00000007 .byte 0
0x00, //0x00000008 .byte 0
0x09, //0x00000009 .byte 9
0x0a, //0x0000000a .byte 10
0x00, //0x0000000b .byte 0
0x00, //0x0000000c .byte 0
0x0d, //0x0000000d .byte 13
0x00, //0x0000000e .byte 0
0x00, //0x0000000f .byte 0
0x20, //0x00000010 .byte 32
0x00, //0x00000011 .byte 0
0x00, //0x00000012 .byte 0
0x00, //0x00000013 .byte 0
0x00, //0x00000014 .byte 0
0x00, //0x00000015 .byte 0
0x00, //0x00000016 .byte 0
0x00, //0x00000017 .byte 0
0x00, //0x00000018 .byte 0
0x09, //0x00000019 .byte 9
0x0a, //0x0000001a .byte 10
0x00, //0x0000001b .byte 0
0x00, //0x0000001c .byte 0
0x0d, //0x0000001d .byte 13
0x00, //0x0000001e .byte 0
0x00, //0x0000001f .byte 0
//0x00000020 .p2align 4, 0x90
//0x00000020 _lspace
0x55, //0x00000020 pushq %rbp
0x48, 0x89, 0xe5, //0x00000021 movq %rsp, %rbp
0x48, 0x89, 0xd0, //0x00000024 movq %rdx, %rax
0x48, 0x89, 0xf1, //0x00000027 movq %rsi, %rcx
0x48, 0x29, 0xd1, //0x0000002a subq %rdx, %rcx
0x48, 0x83, 0xf9, 0x20, //0x0000002d cmpq $32, %rcx
0x0f, 0x82, 0xc0, 0x00, 0x00, 0x00, //0x00000031 jb LBB0_1
0x48, 0x89, 0xc1, //0x00000037 movq %rax, %rcx
0x48, 0xf7, 0xd9, //0x0000003a negq %rcx
0xc5, 0xfe, 0x6f, 0x05, 0xbb, 0xff, 0xff, 0xff, //0x0000003d vmovdqu $-69(%rip), %ymm0 /* LCPI0_0+0(%rip) */
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, //0x00000045 .p2align 4, 0x90
//0x00000050 LBB0_10
0xc5, 0xfe, 0x6f, 0x0c, 0x07, //0x00000050 vmovdqu (%rdi,%rax), %ymm1
0xc4, 0xe2, 0x7d, 0x00, 0xd1, //0x00000055 vpshufb %ymm1, %ymm0, %ymm2
0xc5, 0xf5, 0x74, 0xca, //0x0000005a vpcmpeqb %ymm2, %ymm1, %ymm1
0xc5, 0xfd, 0xd7, 0xd1, //0x0000005e vpmovmskb %ymm1, %edx
0x83, 0xfa, 0xff, //0x00000062 cmpl $-1, %edx
0x0f, 0x85, 0x74, 0x00, 0x00, 0x00, //0x00000065 jne LBB0_11
0x48, 0x83, 0xc0, 0x20, //0x0000006b addq $32, %rax
0x48, 0x8d, 0x14, 0x0e, //0x0000006f leaq (%rsi,%rcx), %rdx
0x48, 0x83, 0xc2, 0xe0, //0x00000073 addq $-32, %rdx
0x48, 0x83, 0xc1, 0xe0, //0x00000077 addq $-32, %rcx
0x48, 0x83, 0xfa, 0x1f, //0x0000007b cmpq $31, %rdx
0x0f, 0x87, 0xcb, 0xff, 0xff, 0xff, //0x0000007f ja LBB0_10
0x48, 0x89, 0xf8, //0x00000085 movq %rdi, %rax
0x48, 0x29, 0xc8, //0x00000088 subq %rcx, %rax
0x48, 0x01, 0xce, //0x0000008b addq %rcx, %rsi
0x48, 0x89, 0xf1, //0x0000008e movq %rsi, %rcx
0x48, 0x85, 0xc9, //0x00000091 testq %rcx, %rcx
0x0f, 0x84, 0x3d, 0x00, 0x00, 0x00, //0x00000094 je LBB0_14
//0x0000009a LBB0_5
0x4c, 0x8d, 0x04, 0x08, //0x0000009a leaq (%rax,%rcx), %r8
0x31, 0xd2, //0x0000009e xorl %edx, %edx
0x49, 0xb9, 0x00, 0x26, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, //0x000000a0 movabsq $4294977024, %r9
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, //0x000000aa .p2align 4, 0x90
//0x000000b0 LBB0_6
0x0f, 0xbe, 0x34, 0x10, //0x000000b0 movsbl (%rax,%rdx), %esi
0x83, 0xfe, 0x20, //0x000000b4 cmpl $32, %esi
0x0f, 0x87, 0x2f, 0x00, 0x00, 0x00, //0x000000b7 ja LBB0_8
0x49, 0x0f, 0xa3, 0xf1, //0x000000bd btq %rsi, %r9
0x0f, 0x83, 0x25, 0x00, 0x00, 0x00, //0x000000c1 jae LBB0_8
0x48, 0x83, 0xc2, 0x01, //0x000000c7 addq $1, %rdx
0x48, 0x39, 0xd1, //0x000000cb cmpq %rdx, %rcx
0x0f, 0x85, 0xdc, 0xff, 0xff, 0xff, //0x000000ce jne LBB0_6
0x4c, 0x89, 0xc0, //0x000000d4 movq %r8, %rax
//0x000000d7 LBB0_14
0x48, 0x29, 0xf8, //0x000000d7 subq %rdi, %rax
0x5d, //0x000000da popq %rbp
0xc5, 0xf8, 0x77, //0x000000db vzeroupper
0xc3, //0x000000de retq
//0x000000df LBB0_11
0xf7, 0xd2, //0x000000df notl %edx
0x0f, 0xbc, 0xc2, //0x000000e1 bsfl %edx, %eax
0x48, 0x29, 0xc8, //0x000000e4 subq %rcx, %rax
0x5d, //0x000000e7 popq %rbp
0xc5, 0xf8, 0x77, //0x000000e8 vzeroupper
0xc3, //0x000000eb retq
//0x000000ec LBB0_8
0x48, 0x29, 0xf8, //0x000000ec subq %rdi, %rax
0x48, 0x01, 0xd0, //0x000000ef addq %rdx, %rax
0x5d, //0x000000f2 popq %rbp
0xc5, 0xf8, 0x77, //0x000000f3 vzeroupper
0xc3, //0x000000f6 retq
//0x000000f7 LBB0_1
0x48, 0x01, 0xf8, //0x000000f7 addq %rdi, %rax
0x48, 0x85, 0xc9, //0x000000fa testq %rcx, %rcx
0x0f, 0x85, 0x97, 0xff, 0xff, 0xff, //0x000000fd jne LBB0_5
0xe9, 0xcf, 0xff, 0xff, 0xff, //0x00000103 jmp LBB0_14
}

View File

@@ -0,0 +1,51 @@
// Code generated by scripts, DO NOT EDIT.
/*
* 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 avx2
import (
`github.com/bytedance/sonic/loader`
)
func Use() {
loader.WrapGoC(_text_f64toa, _cfunc_f64toa, []loader.GoC{{"_f64toa", &S_f64toa, &F_f64toa}}, "avx2", "avx2/f64toa.c")
loader.WrapGoC(_text_f32toa, _cfunc_f32toa, []loader.GoC{{"_f32toa", &S_f32toa, &F_f32toa}}, "avx2", "avx2/f32toa.c")
loader.WrapGoC(_text_get_by_path, _cfunc_get_by_path, []loader.GoC{{"_get_by_path", &S_get_by_path, &F_get_by_path}}, "avx2", "avx2/get_by_path.c")
loader.WrapGoC(_text_html_escape, _cfunc_html_escape, []loader.GoC{{"_html_escape", &S_html_escape, &F_html_escape}}, "avx2", "avx2/html_escape.c")
loader.WrapGoC(_text_i64toa, _cfunc_i64toa, []loader.GoC{{"_i64toa", &S_i64toa, &F_i64toa}}, "avx2", "avx2/i64toa.c")
loader.WrapGoC(_text_lspace, _cfunc_lspace, []loader.GoC{{"_lspace", &S_lspace, &F_lspace}}, "avx2", "avx2/lspace.c")
loader.WrapGoC(_text_quote, _cfunc_quote, []loader.GoC{{"_quote", &S_quote, &F_quote}}, "avx2", "avx2/quote.c")
loader.WrapGoC(_text_skip_array, _cfunc_skip_array, []loader.GoC{{"_skip_array", &S_skip_array, &F_skip_array}}, "avx2", "avx2/skip_array.c")
loader.WrapGoC(_text_skip_number, _cfunc_skip_number, []loader.GoC{{"_skip_number", &S_skip_number, &F_skip_number}}, "avx2", "avx2/skip_number.c")
loader.WrapGoC(_text_skip_one, _cfunc_skip_one, []loader.GoC{{"_skip_one", &S_skip_one, &F_skip_one}}, "avx2", "avx2/skip_one.c")
loader.WrapGoC(_text_skip_object, _cfunc_skip_object, []loader.GoC{{"_skip_object", &S_skip_object, &F_skip_object}}, "avx2", "avx2/skip_object.c")
loader.WrapGoC(_text_skip_one_fast, _cfunc_skip_one_fast, []loader.GoC{{"_skip_one_fast", &S_skip_one_fast, &F_skip_one_fast}}, "avx2", "avx2/skip_one_fast.c")
loader.WrapGoC(_text_u64toa, _cfunc_u64toa, []loader.GoC{{"_u64toa", &S_u64toa, &F_u64toa}}, "avx2", "avx2/u64toa.c")
loader.WrapGoC(_text_unquote, _cfunc_unquote, []loader.GoC{{"_unquote", &S_unquote, &F_unquote}}, "avx2", "avx2/unquote.c")
loader.WrapGoC(_text_validate_one, _cfunc_validate_one, []loader.GoC{{"_validate_one", &S_validate_one, &F_validate_one}}, "avx2", "avx2/validate_one.c")
loader.WrapGoC(_text_validate_utf8, _cfunc_validate_utf8, []loader.GoC{{"_validate_utf8", &S_validate_utf8, &F_validate_utf8}}, "avx2", "avx2/validate_utf8.c")
loader.WrapGoC(_text_validate_utf8_fast, _cfunc_validate_utf8_fast, []loader.GoC{{"_validate_utf8_fast", &S_validate_utf8_fast, &F_validate_utf8_fast}}, "avx2", "avx2/validate_utf8_fast.c")
loader.WrapGoC(_text_vnumber, _cfunc_vnumber, []loader.GoC{{"_vnumber", &S_vnumber, &F_vnumber}}, "avx2", "avx2/vnumber.c")
loader.WrapGoC(_text_vsigned, _cfunc_vsigned, []loader.GoC{{"_vsigned", &S_vsigned, &F_vsigned}}, "avx2", "avx2/vsigned.c")
loader.WrapGoC(_text_vunsigned, _cfunc_vunsigned, []loader.GoC{{"_vunsigned", &S_vunsigned, &F_vunsigned}}, "avx2", "avx2/vunsigned.c")
loader.WrapGoC(_text_vstring, _cfunc_vstring, []loader.GoC{{"_vstring", &S_vstring, &F_vstring}}, "avx2", "avx2/vstring.c")
loader.WrapGoC(_text_value, _cfunc_value, []loader.GoC{{"_value", &S_value, &F_value}}, "avx2", "avx2/value.c")
loader.WrapGoC(_text_parse_with_padding, _cfunc_parse_with_padding, []loader.GoC{{"_parse_with_padding", &S_parse_with_padding, &F_parse_with_padding}}, "avx2", "avx2/parser.c")
loader.WrapGoC(_text_lookup_small_key, _cfunc_lookup_small_key, []loader.GoC{{"_lookup_small_key", &S_lookup_small_key, &F_lookup_small_key}}, "avx2", "avx2/lookup.c")
}

View File

@@ -0,0 +1,36 @@
// Code generated by scripts, DO NOT EDIT.
// Code generated by scripts, DO NOT EDIT.
/*
* 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 avx2
import (
`unsafe`
`github.com/bytedance/sonic/internal/rt`
)
var F_parse_with_padding func(parser unsafe.Pointer) (ret int)
var S_parse_with_padding uintptr
//go:nosplit
func parse_with_padding(parser unsafe.Pointer) (ret int) {
return F_parse_with_padding(rt.NoEscape(parser))
}

View File

@@ -0,0 +1,46 @@
// +build !noasm !appengine
// Code generated by asm2asm, DO NOT EDIT.
package avx2
import (
`github.com/bytedance/sonic/loader`
)
const (
_entry__parse_with_padding = 688
)
const (
_stack__parse_with_padding = 200
)
const (
_size__parse_with_padding = 48876
)
var (
_pcsp__parse_with_padding = [][2]uint32{
{0x1, 0},
{0x6, 8},
{0x8, 16},
{0xa, 24},
{0xc, 32},
{0xd, 40},
{0x14, 48},
{0xbea, 200},
{0xbeb, 48},
{0xbed, 40},
{0xbef, 32},
{0xbf1, 24},
{0xbf3, 16},
{0xbf4, 8},
{0xbf8, 0},
{0xbeec, 200},
}
)
var _cfunc_parse_with_padding = []loader.CFunc{
{"_parse_with_padding_entry", 0, _entry__parse_with_padding, 0, nil},
{"_parse_with_padding", _entry__parse_with_padding, _size__parse_with_padding, _stack__parse_with_padding, _pcsp__parse_with_padding},
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,33 @@
// Code generated by scripts, DO NOT EDIT.
/*
* 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 avx2
import (
`unsafe`
`github.com/bytedance/sonic/internal/rt`
)
var F_quote func(sp unsafe.Pointer, nb int, dp unsafe.Pointer, dn unsafe.Pointer, flags uint64) (ret int)
var S_quote uintptr
//go:nosplit
func quote(sp unsafe.Pointer, nb int, dp unsafe.Pointer, dn *int, flags uint64) (ret int) {
return F_quote(rt.NoEscape(sp), nb, rt.NoEscape(dp), rt.NoEscape(unsafe.Pointer(dn)), flags)
}

Some files were not shown because too many files have changed in this diff Show More