mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-15 00:13:43 +00:00
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).
This commit is contained in:
@@ -1110,7 +1110,7 @@ func (c *Compiler) getInterpretedValue(prefix string, value ir.Value) (llvm.Valu
|
|||||||
|
|
||||||
// Create the hashmap itself.
|
// Create the hashmap itself.
|
||||||
zero := llvm.ConstInt(c.ctx.Int32Type(), 0, false)
|
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")
|
hashmapType := c.mod.GetTypeByName("runtime.hashmap")
|
||||||
hashmap := llvm.ConstNamedStruct(hashmapType, []llvm.Value{
|
hashmap := llvm.ConstNamedStruct(hashmapType, []llvm.Value{
|
||||||
llvm.ConstPointerNull(llvm.PointerType(hashmapType, 0)), // next
|
llvm.ConstPointerNull(llvm.PointerType(hashmapType, 0)), // next
|
||||||
|
|||||||
Reference in New Issue
Block a user