slotTyp := gtyp.Field(1).Type.Elem()
elemOff := slotTyp.Field(1).Offset
+ if AlgType(t.Key()) == types.AMEM64 && elemOff != 8 {
+ base.Fatalf("runtime assumes elemOff for 8-byte keys is 8, got %d", elemOff)
+ }
+ if AlgType(t.Key()) == types.ASTRING && elemOff != int64(2*types.PtrSize) {
+ base.Fatalf("runtime assumes elemOff for string keys is %d, got %d", 2*types.PtrSize, elemOff)
+ }
c.Field("Key").WritePtr(s1)
c.Field("Elem").WritePtr(s2)
slotSize := typ.SlotSize
for full != 0 {
if key == *(*uint64)(slotKey) && full&(1<<7) != 0 {
- slotElem := unsafe.Pointer(uintptr(slotKey) + typ.ElemOff)
+ slotElem := unsafe.Pointer(uintptr(slotKey) + 8)
return slotElem
}
slotKey = unsafe.Pointer(uintptr(slotKey) + slotSize)
slotKey := g.key(typ, i)
if key == *(*uint64)(slotKey) {
- slotElem := unsafe.Pointer(uintptr(slotKey) + typ.ElemOff)
+ slotElem := unsafe.Pointer(uintptr(slotKey) + 8)
return slotElem
}
match = match.removeFirst()
slotSize := typ.SlotSize
for full != 0 {
if key == *(*uint64)(slotKey) && full&(1<<7) != 0 {
- slotElem := unsafe.Pointer(uintptr(slotKey) + typ.ElemOff)
+ slotElem := unsafe.Pointer(uintptr(slotKey) + 8)
return slotElem, true
}
slotKey = unsafe.Pointer(uintptr(slotKey) + slotSize)
slotKey := g.key(typ, i)
if key == *(*uint64)(slotKey) {
- slotElem := unsafe.Pointer(uintptr(slotKey) + typ.ElemOff)
+ slotElem := unsafe.Pointer(uintptr(slotKey) + 8)
return slotElem, true
}
match = match.removeFirst()
import (
"internal/abi"
+ "internal/goarch"
"internal/race"
"internal/runtime/sys"
"unsafe"
// There's exactly one slot that passed the quick test. Do the single expensive comparison.
slotKey = g.key(typ, uintptr(j))
if key == *(*string)(slotKey) {
- return unsafe.Pointer(uintptr(slotKey) + typ.ElemOff)
+ return unsafe.Pointer(uintptr(slotKey) + 2*goarch.PtrSize)
}
return nil
}
for range abi.SwissMapGroupSlots {
if uint8(ctrls) == h2 && key == *(*string)(slotKey) {
- return unsafe.Pointer(uintptr(slotKey) + typ.ElemOff)
+ return unsafe.Pointer(uintptr(slotKey) + 2*goarch.PtrSize)
}
slotKey = unsafe.Pointer(uintptr(slotKey) + slotSize)
ctrls >>= 8
slotKey := g.key(typ, i)
if key == *(*string)(slotKey) {
- slotElem := unsafe.Pointer(uintptr(slotKey) + typ.ElemOff)
+ slotElem := unsafe.Pointer(uintptr(slotKey) + 2*goarch.PtrSize)
return slotElem
}
match = match.removeFirst()
slotKey := g.key(typ, i)
if key == *(*string)(slotKey) {
- slotElem := unsafe.Pointer(uintptr(slotKey) + typ.ElemOff)
+ slotElem := unsafe.Pointer(uintptr(slotKey) + 2*goarch.PtrSize)
return slotElem, true
}
match = match.removeFirst()