package maps
import (
)
func ( *abi.SwissMapType, *Map, uint32) unsafe.Pointer {
if race.Enabled && != nil {
:= sys.GetCallerPC()
:= abi.FuncPCABIInternal()
race.ReadPC(unsafe.Pointer(), , )
}
if == nil || .Used() == 0 {
return unsafe.Pointer(&zeroVal[0])
}
if .writing != 0 {
fatal("concurrent map read and map write")
return nil
}
if .dirLen == 0 {
:= groupReference{
data: .dirPtr,
}
:= .ctrls().matchFull()
:= .key(, 0)
:= .SlotSize
for != 0 {
if == *(*uint32)() && .lowestSet() {
:= unsafe.Pointer(uintptr() + .ElemOff)
return
}
= unsafe.Pointer(uintptr() + )
= .shiftOutLowest()
}
return unsafe.Pointer(&zeroVal[0])
}
:=
:= .Hasher(abi.NoEscape(unsafe.Pointer(&)), .seed)
:= .directoryIndex()
:= .directoryAt()
:= makeProbeSeq(h1(), .groups.lengthMask)
for ; ; = .next() {
:= .groups.group(, .offset)
:= .ctrls().matchH2(h2())
for != 0 {
:= .first()
:= .key(, )
if == *(*uint32)() {
:= unsafe.Pointer(uintptr() + .ElemOff)
return
}
= .removeFirst()
}
= .ctrls().matchEmpty()
if != 0 {
return unsafe.Pointer(&zeroVal[0])
}
}
}
func ( *abi.SwissMapType, *Map, uint32) (unsafe.Pointer, bool) {
if race.Enabled && != nil {
:= sys.GetCallerPC()
:= abi.FuncPCABIInternal()
race.ReadPC(unsafe.Pointer(), , )
}
if == nil || .Used() == 0 {
return unsafe.Pointer(&zeroVal[0]), false
}
if .writing != 0 {
fatal("concurrent map read and map write")
return nil, false
}
if .dirLen == 0 {
:= groupReference{
data: .dirPtr,
}
:= .ctrls().matchFull()
:= .key(, 0)
:= .SlotSize
for != 0 {
if == *(*uint32)() && .lowestSet() {
:= unsafe.Pointer(uintptr() + .ElemOff)
return , true
}
= unsafe.Pointer(uintptr() + )
= .shiftOutLowest()
}
return unsafe.Pointer(&zeroVal[0]), false
}
:=
:= .Hasher(abi.NoEscape(unsafe.Pointer(&)), .seed)
:= .directoryIndex()
:= .directoryAt()
:= makeProbeSeq(h1(), .groups.lengthMask)
for ; ; = .next() {
:= .groups.group(, .offset)
:= .ctrls().matchH2(h2())
for != 0 {
:= .first()
:= .key(, )
if == *(*uint32)() {
:= unsafe.Pointer(uintptr() + .ElemOff)
return , true
}
= .removeFirst()
}
= .ctrls().matchEmpty()
if != 0 {
return unsafe.Pointer(&zeroVal[0]), false
}
}
}
func ( *Map) ( *abi.SwissMapType, uintptr, uint32) unsafe.Pointer {
:= groupReference{
data: .dirPtr,
}
:= .ctrls().matchH2(h2())
for != 0 {
:= .first()
:= .key(, )
if == *(*uint32)() {
:= .elem(, )
return
}
= .removeFirst()
}
= .ctrls().matchEmptyOrDeleted()
if == 0 {
fatal("small map with no empty slot (concurrent map writes?)")
}
:= .first()
:= .key(, )
*(*uint32)() =
:= .elem(, )
.ctrls().set(, ctrl(h2()))
.used++
return
}
func ( *abi.SwissMapType, *Map, uint32) unsafe.Pointer {
if == nil {
panic(errNilAssign)
}
if race.Enabled {
:= sys.GetCallerPC()
:= abi.FuncPCABIInternal()
race.WritePC(unsafe.Pointer(), , )
}
if .writing != 0 {
fatal("concurrent map writes")
}
:=
:= .Hasher(abi.NoEscape(unsafe.Pointer(&)), .seed)
.writing ^= 1
if .dirPtr == nil {
.growToSmall()
}
if .dirLen == 0 {
if .used < abi.SwissMapGroupSlots {
:= .putSlotSmallFast32(, , )
if .writing == 0 {
fatal("concurrent map writes")
}
.writing ^= 1
return
}
.growToTable()
}
var unsafe.Pointer
:
for {
:= .directoryIndex()
:= .directoryAt()
:= makeProbeSeq(h1(), .groups.lengthMask)
var groupReference
var uintptr
for ; ; = .next() {
:= .groups.group(, .offset)
:= .ctrls().matchH2(h2())
for != 0 {
:= .first()
:= .key(, )
if == *(*uint32)() {
= .elem(, )
.checkInvariants(, )
break
}
= .removeFirst()
}
= .ctrls().matchEmptyOrDeleted()
if == 0 {
continue
}
:= .first()
if .ctrls().get() == ctrlDeleted {
if .data == nil {
=
=
}
continue
}
if .data != nil {
=
=
.growthLeft++
}
if .growthLeft > 0 {
:= .key(, )
*(*uint32)() =
= .elem(, )
.ctrls().set(, ctrl(h2()))
.growthLeft--
.used++
.used++
.checkInvariants(, )
break
}
.rehash(, )
continue
}
}
if .writing == 0 {
fatal("concurrent map writes")
}
.writing ^= 1
return
}
func ( *abi.SwissMapType, *Map, unsafe.Pointer) unsafe.Pointer {
if == nil {
panic(errNilAssign)
}
if race.Enabled {
:= sys.GetCallerPC()
:= abi.FuncPCABIInternal()
race.WritePC(unsafe.Pointer(), , )
}
if .writing != 0 {
fatal("concurrent map writes")
}
:=
:= .Hasher(abi.NoEscape(unsafe.Pointer(&)), .seed)
.writing ^= 1
if .dirPtr == nil {
.growToSmall()
}
if .dirLen == 0 {
if .used < abi.SwissMapGroupSlots {
:= .putSlotSmallFastPtr(, , )
if .writing == 0 {
fatal("concurrent map writes")
}
.writing ^= 1
return
}
.growToTable()
}
var unsafe.Pointer
:
for {
:= .directoryIndex()
:= .directoryAt()
:= makeProbeSeq(h1(), .groups.lengthMask)
var groupReference
var uintptr
for ; ; = .next() {
:= .groups.group(, .offset)
:= .ctrls().matchH2(h2())
for != 0 {
:= .first()
:= .key(, )
if == *(*unsafe.Pointer)() {
= .elem(, )
.checkInvariants(, )
break
}
= .removeFirst()
}
= .ctrls().matchEmptyOrDeleted()
if == 0 {
continue
}
:= .first()
if .ctrls().get() == ctrlDeleted {
if .data == nil {
=
=
}
continue
}
if .data != nil {
=
=
.growthLeft++
}
if .growthLeft > 0 {
:= .key(, )
*(*unsafe.Pointer)() =
= .elem(, )
.ctrls().set(, ctrl(h2()))
.growthLeft--
.used++
.used++
.checkInvariants(, )
break
}
.rehash(, )
continue
}
}
if .writing == 0 {
fatal("concurrent map writes")
}
.writing ^= 1
return
}
func ( *abi.SwissMapType, *Map, uint32) {
if race.Enabled {
:= sys.GetCallerPC()
:= abi.FuncPCABIInternal()
race.WritePC(unsafe.Pointer(), , )
}
if == nil || .Used() == 0 {
return
}
.Delete(, abi.NoEscape(unsafe.Pointer(&)))
}