From e1e3dbdce668ebb01a928dad6a4ce6d21010bdc0 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Wed, 10 Oct 2018 14:06:59 +0200 Subject: [PATCH] compiler: correctly generate global hashmaps of size > 8 Static map generation used the last bucket instead of the first bucket in the chain, which caused lots of missing entries in hashmaps with multiple buckets (size > 8). --- compiler/compiler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/compiler.go b/compiler/compiler.go index 9d6a51f3..38b68351 100644 --- a/compiler/compiler.go +++ b/compiler/compiler.go @@ -1110,7 +1110,7 @@ func (c *Compiler) getInterpretedValue(prefix string, value ir.Value) (llvm.Valu // Create the hashmap itself. zero := llvm.ConstInt(c.ctx.Int32Type(), 0, false) - bucketPtr := llvm.ConstInBoundsGEP(bucketGlobal, []llvm.Value{zero}) + bucketPtr := llvm.ConstInBoundsGEP(firstBucketGlobal, []llvm.Value{zero}) hashmapType := c.mod.GetTypeByName("runtime.hashmap") hashmap := llvm.ConstNamedStruct(hashmapType, []llvm.Value{ llvm.ConstPointerNull(llvm.PointerType(hashmapType, 0)), // next