处理AI胡乱生成的乱摊子
This commit is contained in:
7
vendor/github.com/chenzhuoyu/base64x/Makefile
generated
vendored
7
vendor/github.com/chenzhuoyu/base64x/Makefile
generated
vendored
@@ -19,10 +19,11 @@ NATIVE_SRC += $(wildcard native/*.c)
|
||||
all: native_amd64.s
|
||||
|
||||
clean:
|
||||
rm -vf native_amd64.s output/*.s
|
||||
rm -vf native_text_amd64.go native_subr_amd64.go output/*.s
|
||||
|
||||
native_amd64.s: ${NATIVE_SRC} ${NATIVE_ASM} native_amd64.go
|
||||
mkdir -p output
|
||||
clang ${CFLAGS} -S -o output/native.s native/native.c
|
||||
python3 tools/asm2asm/asm2asm.py native_amd64.s output/native.s ${NATIVE_ASM}
|
||||
asmfmt -w native_amd64.s
|
||||
python3 tools/asm2asm/asm2asm.py -r native_amd64.go output/native.s ${NATIVE_ASM}
|
||||
awk '{gsub(/Text__native_entry__/, "text__native_entry__")}1' native_text_amd64.go > native_text_amd64.go.tmp && mv native_text_amd64.go.tmp native_text_amd64.go
|
||||
awk '{gsub(/Funcs/, "funcs")}1' native_subr_amd64.go > native_subr_amd64.go.tmp && mv native_subr_amd64.go.tmp native_subr_amd64.go
|
||||
|
||||
10
vendor/github.com/chenzhuoyu/base64x/base64x.go
generated
vendored
10
vendor/github.com/chenzhuoyu/base64x/base64x.go
generated
vendored
@@ -71,7 +71,7 @@ func (self Encoding) Encode(out []byte, src []byte) {
|
||||
//
|
||||
// It will also update the length of out.
|
||||
func (self Encoding) EncodeUnsafe(out *[]byte, src []byte) {
|
||||
__b64encode(out, &src, int(self) | archFlags)
|
||||
b64encode(out, &src, int(self) | archFlags)
|
||||
}
|
||||
|
||||
// EncodeToString returns the base64 encoding of src.
|
||||
@@ -120,7 +120,7 @@ func (self Encoding) Decode(out []byte, src []byte) (int, error) {
|
||||
//
|
||||
// It will also update the length of out.
|
||||
func (self Encoding) DecodeUnsafe(out *[]byte, src []byte) (int, error) {
|
||||
if n := __b64decode(out, mem2addr(src), len(src), int(self) | archFlags); n >= 0 {
|
||||
if n := b64decode(out, mem2addr(src), len(src), int(self) | archFlags); n >= 0 {
|
||||
return n, nil
|
||||
} else {
|
||||
return 0, base64.CorruptInputError(-n - 1)
|
||||
@@ -149,9 +149,3 @@ func (self Encoding) DecodedLen(n int) int {
|
||||
return n * 6 / 8
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
if hasAVX2() {
|
||||
archFlags = _MODE_AVX2
|
||||
}
|
||||
}
|
||||
|
||||
2
vendor/github.com/chenzhuoyu/base64x/cpuid.go
generated
vendored
2
vendor/github.com/chenzhuoyu/base64x/cpuid.go
generated
vendored
@@ -14,4 +14,4 @@ func hasAVX2() bool {
|
||||
case "noavx2" : return false
|
||||
default : panic(fmt.Sprintf("invalid mode: '%s', should be one of 'auto', 'noavx2'", v))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
12
vendor/github.com/chenzhuoyu/base64x/faststr.go
generated
vendored
12
vendor/github.com/chenzhuoyu/base64x/faststr.go
generated
vendored
@@ -21,3 +21,15 @@ func str2mem(s string) (v []byte) {
|
||||
func mem2addr(v []byte) unsafe.Pointer {
|
||||
return *(*unsafe.Pointer)(unsafe.Pointer(&v))
|
||||
}
|
||||
|
||||
// NoEscape hides a pointer from escape analysis. NoEscape is
|
||||
// the identity function but escape analysis doesn't think the
|
||||
// output depends on the input. NoEscape is inlined and currently
|
||||
// compiles down to zero instructions.
|
||||
// USE CAREFULLY!
|
||||
//go:nosplit
|
||||
//goland:noinspection GoVetUnsafePointer
|
||||
func noEscape(p unsafe.Pointer) unsafe.Pointer {
|
||||
x := uintptr(p)
|
||||
return unsafe.Pointer(x ^ 0)
|
||||
}
|
||||
|
||||
38
vendor/github.com/chenzhuoyu/base64x/native_amd64.go
generated
vendored
38
vendor/github.com/chenzhuoyu/base64x/native_amd64.go
generated
vendored
@@ -3,14 +3,40 @@ package base64x
|
||||
|
||||
import (
|
||||
`unsafe`
|
||||
|
||||
`github.com/bytedance/sonic/loader`
|
||||
)
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __b64encode(out *[]byte, src *[]byte, mode int)
|
||||
func b64encode(out *[]byte, src *[]byte, mode int) {
|
||||
__b64encode(noEscape(unsafe.Pointer(out)), noEscape(unsafe.Pointer(src)), mode)
|
||||
}
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection GoUnusedParameter
|
||||
func __b64decode(out *[]byte, src unsafe.Pointer, len int, mode int) (ret int)
|
||||
func b64decode(out *[]byte, src unsafe.Pointer, len int, mode int) (ret int) {
|
||||
return __b64decode(noEscape(unsafe.Pointer(out)), noEscape(unsafe.Pointer(src)), len, mode)
|
||||
}
|
||||
|
||||
// asm2asm templates
|
||||
var (
|
||||
__b64encode func(out unsafe.Pointer, src unsafe.Pointer, mod int)
|
||||
__b64decode func(out unsafe.Pointer, src unsafe.Pointer, len int, mod int) (ret int)
|
||||
)
|
||||
|
||||
// directly jump PCs
|
||||
var (
|
||||
_subr__b64encode uintptr
|
||||
_subr__b64decode uintptr
|
||||
)
|
||||
|
||||
var stubs = []loader.GoC{
|
||||
{"_b64encode", &_subr__b64encode, &__b64encode},
|
||||
{"_b64decode", &_subr__b64decode, &__b64decode},
|
||||
}
|
||||
|
||||
func init() {
|
||||
if hasAVX2() {
|
||||
archFlags = _MODE_AVX2
|
||||
}
|
||||
loader.WrapGoC(text__native_entry__, funcs, stubs, "base64x", "base64x/native.c")
|
||||
}
|
||||
|
||||
4416
vendor/github.com/chenzhuoyu/base64x/native_amd64.s
generated
vendored
4416
vendor/github.com/chenzhuoyu/base64x/native_amd64.s
generated
vendored
File diff suppressed because it is too large
Load Diff
64
vendor/github.com/chenzhuoyu/base64x/native_subr_amd64.go
generated
vendored
64
vendor/github.com/chenzhuoyu/base64x/native_subr_amd64.go
generated
vendored
@@ -3,27 +3,61 @@
|
||||
|
||||
package base64x
|
||||
|
||||
//go:nosplit
|
||||
//go:noescape
|
||||
//goland:noinspection ALL
|
||||
func __native_entry__() uintptr
|
||||
|
||||
var (
|
||||
_subr__b64decode = __native_entry__() + 1563
|
||||
_subr__b64encode = __native_entry__() + 301
|
||||
import (
|
||||
`github.com/bytedance/sonic/loader`
|
||||
)
|
||||
|
||||
const (
|
||||
_stack__b64decode = 128
|
||||
_entry__b64decode = 1328
|
||||
_entry__b64encode = 256
|
||||
)
|
||||
|
||||
const (
|
||||
_stack__b64decode = 152
|
||||
_stack__b64encode = 40
|
||||
)
|
||||
|
||||
var (
|
||||
_ = _subr__b64decode
|
||||
_ = _subr__b64encode
|
||||
const (
|
||||
_size__b64decode = 17616
|
||||
_size__b64encode = 864
|
||||
)
|
||||
|
||||
const (
|
||||
_ = _stack__b64decode
|
||||
_ = _stack__b64encode
|
||||
var (
|
||||
_pcsp__b64decode = [][2]uint32{
|
||||
{1, 0},
|
||||
{4, 8},
|
||||
{6, 16},
|
||||
{8, 24},
|
||||
{10, 32},
|
||||
{12, 40},
|
||||
{13, 48},
|
||||
{17560, 152},
|
||||
{17564, 48},
|
||||
{17565, 40},
|
||||
{17567, 32},
|
||||
{17569, 24},
|
||||
{17571, 16},
|
||||
{17573, 8},
|
||||
{17577, 0},
|
||||
{17608, 152},
|
||||
}
|
||||
_pcsp__b64encode = [][2]uint32{
|
||||
{1, 0},
|
||||
{4, 8},
|
||||
{6, 16},
|
||||
{8, 24},
|
||||
{10, 32},
|
||||
{852, 40},
|
||||
{853, 32},
|
||||
{855, 24},
|
||||
{857, 16},
|
||||
{859, 8},
|
||||
{864, 0},
|
||||
}
|
||||
)
|
||||
|
||||
var funcs = []loader.CFunc{
|
||||
{"__native_entry__", 0, 67, 0, nil},
|
||||
{"_b64decode", _entry__b64decode, _size__b64decode, _stack__b64decode, _pcsp__b64decode},
|
||||
{"_b64encode", _entry__b64encode, _size__b64encode, _stack__b64encode, _pcsp__b64encode},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user