aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata/map.txt
AgeCommit message (Collapse)Author
2023-02-25runtime: properly turn pointer into empty interface when hashingDamian Gryski
2022-04-28testdata: move map growth test to map.goDamian Gryski
2021-12-09src/runtime: fix nil map dereferenceDamian Gryski
Operations on nil maps are accepted and shouldn't panic. The base hashmapGet/hashmapDelete handled nil-maps correctly, but the hashmapBinary versions could segfault accessing the nil map while trying to hash the key. Fixes #2341
2021-12-09compiler: fix ranging over maps with particular map typesAyke van Laethem
Some map keys are hard to compare, such as floats. They are stored as if the map keys are of interface type instead of the key type itself. This makes working with them in the runtime package easier: they are compared as regular interfaces. Iterating over maps didn't care about this special case though. It just returns the key, value pair as it is stored in the map. This is buggy, and this commit fixes this bug.
2021-12-08src/runtime: improve float/complex hashingDamian Gryski
This allows positive and negative zero to hash to the same value, as required by Go. This is not perfect, but the best I could do without revamping all the hash funtions to take a seed. Fixes #2356
2021-04-21interp: remove map supportAyke van Laethem
The interp package is in many cases able to execute map functions in the runtime directly. This is probably slower than adding special support for them in the interp package and also doesn't cover all cases (most importantly, map keys that contain pointers) but removing this code also removes a large amount of code that needs to be maintained and is susceptible to hard-to-find bugs. As a side effect, this resulted in different output of the testdata/map.go test because the test relied on the existing iteration order of TinyGo maps. I've updated the test to not rely on this test, making the output compatible with what the Go toolchain would output.
2020-02-26compiler,runtime: support operations on nil mapAyke van Laethem
The index expression and delete keyword are valid on nil maps, so the runtime must be modified to support this.
2020-01-27compiler,runtime: implement maps for arbitrary keysAyke van Laethem
This implementation simply casts types without special support to an interface, to make the implementation simpler and possibly reducing the code size too. It will likely be slower than the canonical Go implementation though (which builds special compare and hash functions at compile time).
2019-05-14runtime: implement growing hashmapsAyke van Laethem
Add support for growing hashmaps beyond their initial size.
2019-05-14compiler,runtime: use the size hint when creating a new mapAyke van Laethem
It defaults to hint/8 number of buckets. This number may be tuned in the future.
2019-01-31compiler: support for byte arrays as keys in mapsKonstantin Yegupov
2019-01-31interp: support map literals with integer keysKonstantin Yegupov
2018-10-27compiler: implement operations on nil hashmapsAyke van Laethem
* comparing a map against nil * getting the length of a nil map
2018-10-20compiler: support comma-ok in map lookupAyke van Laethem
2018-10-20compiler, runtime: implement delete builtinAyke van Laethem
2018-10-10test: add hashmap testsAyke van Laethem
Hashmaps are still very primitive. These tests check that there are at least no regressions in hashmap support.