|
|
@@ -132,7 +132,7 @@ const (
|
|
|
// should use "runtime/internal/sys".CacheLineSize, but that is not exposed.
|
|
|
cacheLineSize = 64
|
|
|
|
|
|
- wordSizeBits = strconv.IntSize
|
|
|
+ wordSizeBits = 32 << (^uint(0) >> 63) // strconv.IntSize
|
|
|
wordSize = wordSizeBits / 8
|
|
|
|
|
|
maxLevelsEmbedding = 15 // use this, so structFieldInfo fits into 8 bytes
|
|
|
@@ -440,10 +440,13 @@ type BasicHandle struct {
|
|
|
RPCOptions
|
|
|
|
|
|
// ---- cache line
|
|
|
+
|
|
|
DecodeOptions
|
|
|
|
|
|
// ---- cache line
|
|
|
+
|
|
|
EncodeOptions
|
|
|
+
|
|
|
// noBuiltInTypeChecker
|
|
|
}
|
|
|
|
|
|
@@ -1148,7 +1151,7 @@ func (x *TypeInfos) get(rtid uintptr, rt reflect.Type) (pti *typeInfo) {
|
|
|
sp := x.infos.load()
|
|
|
var idx int
|
|
|
if sp != nil {
|
|
|
- idx, pti = x.find(*sp, rtid)
|
|
|
+ idx, pti = x.find(sp, rtid)
|
|
|
if pti != nil {
|
|
|
return
|
|
|
}
|
|
|
@@ -1222,16 +1225,17 @@ func (x *TypeInfos) get(rtid uintptr, rt reflect.Type) (pti *typeInfo) {
|
|
|
sp = x.infos.load()
|
|
|
if sp == nil {
|
|
|
pti = &ti
|
|
|
- vs := append(make([]rtid2ti, 0, 16), rtid2ti{rtid, pti})
|
|
|
- x.infos.store(&vs)
|
|
|
+ vs := []rtid2ti{{rtid, pti}}
|
|
|
+ x.infos.store(vs)
|
|
|
} else {
|
|
|
- idx, pti = x.find(*sp, rtid)
|
|
|
+ idx, pti = x.find(sp, rtid)
|
|
|
if pti == nil {
|
|
|
pti = &ti
|
|
|
- vs := append(*sp, rtid2ti{})
|
|
|
- copy(vs[idx+1:], vs[idx:])
|
|
|
+ vs := make([]rtid2ti, len(sp)+1)
|
|
|
+ copy(vs, sp[:idx])
|
|
|
+ copy(vs[idx+1:], sp[idx:])
|
|
|
vs[idx] = rtid2ti{rtid, pti}
|
|
|
- x.infos.store(&vs)
|
|
|
+ x.infos.store(vs)
|
|
|
}
|
|
|
}
|
|
|
x.mu.Unlock()
|