compiler,runtime: allow map values >256 bytes
Этот коммит содержится в:
родитель
c41a212712
коммит
530ca0838d
2 изменённых файлов: 3 добавлений и 3 удалений
|
@ -42,7 +42,7 @@ func (b *builder) createMakeMap(expr *ssa.MakeMap) (llvm.Value, error) {
|
||||||
keySize := b.targetData.TypeAllocSize(llvmKeyType)
|
keySize := b.targetData.TypeAllocSize(llvmKeyType)
|
||||||
valueSize := b.targetData.TypeAllocSize(llvmValueType)
|
valueSize := b.targetData.TypeAllocSize(llvmValueType)
|
||||||
llvmKeySize := llvm.ConstInt(b.ctx.Int8Type(), keySize, false)
|
llvmKeySize := llvm.ConstInt(b.ctx.Int8Type(), keySize, false)
|
||||||
llvmValueSize := llvm.ConstInt(b.ctx.Int8Type(), valueSize, false)
|
llvmValueSize := llvm.ConstInt(b.ctx.Int32Type(), valueSize, false)
|
||||||
sizeHint := llvm.ConstInt(b.uintptrType, 8, false)
|
sizeHint := llvm.ConstInt(b.uintptrType, 8, false)
|
||||||
algEnum := llvm.ConstInt(b.ctx.Int8Type(), alg, false)
|
algEnum := llvm.ConstInt(b.ctx.Int8Type(), alg, false)
|
||||||
if expr.Reserve != nil {
|
if expr.Reserve != nil {
|
||||||
|
|
|
@ -15,8 +15,8 @@ type hashmap struct {
|
||||||
buckets unsafe.Pointer // pointer to array of buckets
|
buckets unsafe.Pointer // pointer to array of buckets
|
||||||
seed uintptr
|
seed uintptr
|
||||||
count uintptr
|
count uintptr
|
||||||
|
valueSize uint32
|
||||||
keySize uint8 // maybe this can store the key type as well? E.g. keysize == 5 means string?
|
keySize uint8 // maybe this can store the key type as well? E.g. keysize == 5 means string?
|
||||||
valueSize uint8
|
|
||||||
bucketBits uint8
|
bucketBits uint8
|
||||||
keyEqual func(x, y unsafe.Pointer, n uintptr) bool
|
keyEqual func(x, y unsafe.Pointer, n uintptr) bool
|
||||||
keyHash func(key unsafe.Pointer, size, seed uintptr) uint32
|
keyHash func(key unsafe.Pointer, size, seed uintptr) uint32
|
||||||
|
@ -60,7 +60,7 @@ func hashmapTopHash(hash uint32) uint8 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new hashmap with the given keySize and valueSize.
|
// Create a new hashmap with the given keySize and valueSize.
|
||||||
func hashmapMake(keySize, valueSize uint8, sizeHint uintptr, alg uint8) *hashmap {
|
func hashmapMake(keySize uint8, valueSize uint32, sizeHint uintptr, alg uint8) *hashmap {
|
||||||
numBuckets := sizeHint / 8
|
numBuckets := sizeHint / 8
|
||||||
bucketBits := uint8(0)
|
bucketBits := uint8(0)
|
||||||
for numBuckets != 0 {
|
for numBuckets != 0 {
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче