[chore] Update all but bun libraries (#526)

* update all but bun libraries

Signed-off-by: kim <grufwub@gmail.com>

* remove my personal build script changes

Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
kim
2022-05-02 14:05:18 +01:00
committed by GitHub
parent e06bf9cc9a
commit b56dae8120
350 changed files with 305366 additions and 5943 deletions

View File

@ -811,6 +811,9 @@ func (d *bincDecDriver) DecodeBytes(bs []byte) (bsOut []byte) {
for i := 0; i < slen; i++ {
bs[i] = uint8(chkOvf.UintV(d.DecodeUint64(), 8))
}
for i := len(bs); i < slen; i++ {
bs = append(bs, uint8(chkOvf.UintV(d.DecodeUint64(), 8)))
}
return bs
}
var clen int

View File

@ -610,6 +610,9 @@ func (d *cborDecDriver) DecodeBytes(bs []byte) (bsOut []byte) {
for i := 0; i < len(bs); i++ {
bs[i] = uint8(chkOvf.UintV(d.DecodeUint64(), 8))
}
for i := len(bs); i < slen; i++ {
bs = append(bs, uint8(chkOvf.UintV(d.DecodeUint64(), 8)))
}
return bs
}
clen := d.decLen()

View File

@ -132,12 +132,20 @@ var fi64 = floatinfo{52, 22, 15, false, 1<<52 - 1}
var fi64u = floatinfo{0, 19, 0, true, fUint64Cutoff}
func noFrac64(fbits uint64) bool {
if fbits == 0 {
return true
}
exp := uint64(fbits>>52)&0x7FF - 1023 // uint(x>>shift)&mask - bias
// clear top 12+e bits, the integer part; if the rest is 0, then no fraction.
return exp < 52 && fbits<<(12+exp) == 0 // means there's no fractional part
}
func noFrac32(fbits uint32) bool {
if fbits == 0 {
return true
}
exp := uint32(fbits>>23)&0xFF - 127 // uint(x>>shift)&mask - bias
// clear top 9+e bits, the integer part; if the rest is 0, then no fraction.
return exp < 23 && fbits<<(9+exp) == 0 // means there's no fractional part

View File

@ -78,7 +78,7 @@ if {{var "l"}} == 0 {
{{var "v"}} = {{var "v"}}[:{{var "j"}}]
{{var "c"}} = true
} else if {{var "j"}} == 0 && {{var "v"}} == nil {
{{var "v"}} = make([]{{ .Typ }}, 0)
{{var "v"}} = []{{ .Typ }}{}
{{var "c"}} = true
}
{{end -}}

View File

@ -149,7 +149,7 @@ if {{var "l"}} == 0 {
{{var "v"}} = {{var "v"}}[:{{var "j"}}]
{{var "c"}} = true
} else if {{var "j"}} == 0 && {{var "v"}} == nil {
{{var "v"}} = make([]{{ .Typ }}, 0)
{{var "v"}} = []{{ .Typ }}{}
{{var "c"}} = true
}
{{end -}}

View File

@ -943,13 +943,18 @@ func (x *basicHandleRuntimeState) setExt(rt reflect.Type, tag uint64, ext Ext) (
}
rtid := rt2id(rt)
// handle all natively supported type appropriately, so they cannot have an extension.
// However, we do not return an error for these, as we do not document that.
// Instead, we silently treat as a no-op, and return.
switch rtid {
case timeTypId, rawTypId, rawExtTypId:
// these are all natively supported type, so they cannot have an extension.
// However, we do not return an error for these, as we do not document that.
// Instead, we silently treat as a no-op, and return.
case rawTypId, rawExtTypId:
return
case timeTypId:
if x.timeBuiltin {
return
}
}
for i := range x.extHandle {
v := &x.extHandle[i]
if v.rtid == rtid {
@ -1966,7 +1971,7 @@ func (ti *typeInfo) init(x []structFieldInfo, n int) {
// Handling flagCanTransient
//
// We support transient optimization if the kind of the type is
// a number, bool, string, or slice.
// a number, bool, string, or slice (of number/bool).
// In addition, we also support if the kind is struct or array,
// and the type does not contain any pointers recursively).
//
@ -1976,15 +1981,20 @@ func (ti *typeInfo) init(x []structFieldInfo, n int) {
// when GC tries to follow a "transient" pointer which may become a non-pointer soon after.
//
func isCanTransient(t reflect.Type, k reflect.Kind) (v bool) {
var bs *bitset32
func transientBitsetFlags() *bitset32 {
if transientValueHasStringSlice {
bs = &numBoolStrSliceBitset
} else {
bs = &numBoolBitset
return &numBoolStrSliceBitset
}
return &numBoolBitset
}
func isCanTransient(t reflect.Type, k reflect.Kind) (v bool) {
var bs = transientBitsetFlags()
if bs.isset(byte(k)) {
v = true
} else if k == reflect.Slice {
elem := t.Elem()
v = numBoolBitset.isset(byte(elem.Kind()))
} else if k == reflect.Array {
elem := t.Elem()
v = isCanTransient(elem, elem.Kind())
@ -2010,8 +2020,7 @@ func (ti *typeInfo) doSetFlagCanTransient() {
ti.flagCanTransient = true
}
if ti.flagCanTransient {
// if ti kind is a num, bool, string or slice, then it is flagCanTransient
if !numBoolStrSliceBitset.isset(ti.kind) {
if !transientBitsetFlags().isset(ti.kind) {
ti.flagCanTransient = isCanTransient(ti.rt, reflect.Kind(ti.kind))
}
}
@ -2472,13 +2481,19 @@ func panicValToErr(h errDecorator, v interface{}, err *error) {
}
func usableByteSlice(bs []byte, slen int) (out []byte, changed bool) {
const maxCap = 1024 * 1024 * 64 // 64MB
const skipMaxCap = false // allow to test
if slen <= 0 {
return []byte{}, true
}
if cap(bs) < slen {
if slen <= cap(bs) {
return bs[:slen], false
}
// slen > cap(bs) ... handle memory overload appropriately
if skipMaxCap || slen <= maxCap {
return make([]byte, slen), true
}
return bs[:slen], false
return make([]byte, maxCap), true
}
func mapKeyFastKindFor(k reflect.Kind) mapKeyFastKind {

View File

@ -376,6 +376,7 @@ func i2rtid(i interface{}) uintptr {
// --------------------------
func unsafeCmpZero(ptr unsafe.Pointer, size int) bool {
// verified that size is always within right range, so no chance of OOM
var s1 = unsafeString{ptr, size}
var s2 = unsafeString{unsafeZeroAddr, size}
if size > len(unsafeZeroArr) {

View File

@ -851,6 +851,9 @@ func (d *msgpackDecDriver) DecodeBytes(bs []byte) (bsOut []byte) {
for i := 0; i < len(bs); i++ {
bs[i] = uint8(chkOvf.UintV(d.DecodeUint64(), 8))
}
for i := len(bs); i < slen; i++ {
bs = append(bs, uint8(chkOvf.UintV(d.DecodeUint64(), 8)))
}
return bs
} else {
d.d.errorf("invalid byte descriptor for decoding bytes, got: 0x%x", d.bd)

View File

@ -8,9 +8,11 @@ import "io"
// decReader abstracts the reading source, allowing implementations that can
// read from an io.Reader or directly off a byte slice with zero-copying.
type decReader interface {
// readx will use the implementation scratch buffer if possible i.e. n < len(scratchbuf), OR
// just return a view of the []byte being decoded from.
// readx will return a view of the []byte if decoding from a []byte, OR
// read into the implementation scratch buffer if possible i.e. n < len(scratchbuf), OR
// create a new []byte and read into that
readx(n uint) []byte
readb([]byte)
readn1() byte

View File

@ -449,6 +449,9 @@ func (d *simpleDecDriver) DecodeBytes(bs []byte) (bsOut []byte) {
for i := 0; i < len(bs); i++ {
bs[i] = uint8(chkOvf.UintV(d.DecodeUint64(), 8))
}
for i := len(bs); i < slen; i++ {
bs = append(bs, uint8(chkOvf.UintV(d.DecodeUint64(), 8)))
}
return bs
}