aboutsummaryrefslogtreecommitdiff
path: root/py/map.c
AgeCommit message (Collapse)Author
2014-04-07py: Revert revert for allocation policy of set hash table.Damien George
2014-04-07py: Revert change to allocation policy for mp_set_t.Damien George
Seems that this fixes all set tests.
2014-04-06py: Fix dict.copy() and low-level map/set allocation.Paul Sokolovsky
Two things: 1) set flags in copy properly; make mp_map_init() not be too smart and do something with requested alloc size. Policy of using prime numbers for alloc size is high-level policy which should be applied at corresponding high levels. Low-level functions should just do what they're asked to, because they don't have enough context to be smarter than that. For example, munging with alloc size of course breaks dict copying (as changing sizes requires rehashing).
2014-04-05py: Make mp_map_lookup not allocate memory on removal.Damien George
2014-04-05py: Change module globals from mp_map_t* to mp_obj_dict_t*.Damien George
Towards addressing issue #424. Had a small increase to ROM usage (order 60 bytes).
2014-04-05py: Fix delete operation on map/dict and set objects.Damien George
Hash table can now be completely full (ie now NULL entry) before a resize is triggered. Use sentinel value to indicate delete entry in the table.
2014-04-05map: When removing a key, don't NULL the entry, but mark as deleted.Paul Sokolovsky
When searching next time, such entry should be just skipped, not terminate the search. It's known that marking techique is not efficient at the presense of many removes, but namespace usage should not require many deletes, and as for user dictionaries - well, open addressing map table with linear rehashing and load factor of ~1 is not particularly efficient at all ;-). TODO: May consider "shift other entries in cluster" approach as an alternative.
2014-04-05map: Add mp_map_dump() (#ifdef'ed) to be handy when debugging maps.Paul Sokolovsky
2014-03-30Merge map.h into obj.h.Damien George
Pretty much everyone needs to include map.h, since it's such an integral part of the Micro Python object implementation. Thus, the definitions are now in obj.h instead. map.h is removed.
2014-03-17py: Clean up includes.xbe
Remove unnecessary includes. Add includes that improve portability.
2014-02-12Replace global "static" -> "STATIC", to allow "analysis builds". Part 2.Paul Sokolovsky
2014-02-08py: Allow mp_map_t to be initialised by a fixed-size, const table.Damien George
This allows keyword maps to be created directly from stack data.
2014-01-25Add mp_map_deinit() & mp_map_free() to finalize maps.Paul Sokolovsky
mp_map_deinit() finalizes static map, mp_map_free() - dynamic.
2014-01-21Revamp qstrs: they now include length and hash.Damien George
Can now have null bytes in strings. Can define ROM qstrs per port using qstrdefsport.h
2014-01-12Implemented set.removeJohn R. Lenton
2014-01-12Implemented set.discardJohn R. Lenton
2014-01-12Implemented set.clearJohn R. Lenton
2014-01-08py: Stuff qstr in object pointer; keys for mp_map_t are now always mp_obj_t.Damien George
2014-01-07Added dict.setdefaultJohn R. Lenton
2014-01-07implemented dict.popJohn R. Lenton
2014-01-07Added dict.clear.John R. Lenton
Added 0 to the list of primes. Funky primes, these.
2013-12-29Change memory allocation API to require size for free and realloc.Damien
2013-12-21Change object representation from 1 big union to individual structs.Damien
A big change. Micro Python objects are allocated as individual structs with the first element being a pointer to the type information (which is itself an object). This scheme follows CPython. Much more flexible, not necessarily slower, uses same heap memory, and can allocate objects statically. Also change name prefix, from py_ to mp_ (mp for Micro Python).
2013-12-17py: split runtime into map, obj, builtin.Damien