Skip to content
Snippets Groups Projects
  1. Feb 12, 2019
    • Damien George's avatar
      054dd33e
    • Damien George's avatar
      py: Downcase all MP_OBJ_IS_xxx macros to make a more consistent C API. · eee1e884
      Damien George authored
      These macros could in principle be (inline) functions so it makes sense to
      have them lower case, to match the other C API functions.
      
      The remaining macros that are upper case are:
      - MP_OBJ_TO_PTR, MP_OBJ_FROM_PTR
      - MP_OBJ_NEW_SMALL_INT, MP_OBJ_SMALL_INT_VALUE
      - MP_OBJ_NEW_QSTR, MP_OBJ_QSTR_VALUE
      - MP_OBJ_FUN_MAKE_SIG
      - MP_DECLARE_CONST_xxx
      - MP_DEFINE_CONST_xxx
      
      These must remain macros because they are used when defining const data (at
      least, MP_OBJ_NEW_SMALL_INT is so it makes sense to have
      MP_OBJ_SMALL_INT_VALUE also a macro).
      
      For those macros that have been made lower case, compatibility macros are
      provided for the old names so that users do not need to change their code
      immediately.
      eee1e884
  2. Aug 02, 2018
  3. Dec 19, 2017
  4. Dec 09, 2017
  5. Oct 04, 2017
    • Damien George's avatar
      all: Remove inclusion of internal py header files. · a3dc1b19
      Damien George authored
      Header files that are considered internal to the py core and should not
      normally be included directly are:
          py/nlr.h - internal nlr configuration and declarations
          py/bc0.h - contains bytecode macro definitions
          py/runtime0.h - contains basic runtime enums
      
      Instead, the top-level header files to include are one of:
          py/obj.h - includes runtime0.h and defines everything to use the
              mp_obj_t type
          py/runtime.h - includes mpstate.h and hence nlr.h, obj.h, runtime0.h,
              and defines everything to use the general runtime support functions
      
      Additional, specific headers (eg py/objlist.h) can be included if needed.
      a3dc1b19
  6. Aug 31, 2017
  7. Jul 31, 2017
  8. Mar 03, 2017
    • Damien George's avatar
      py/map: Fix bugs with deletion of elements from OrderedDict. · 9275c182
      Damien George authored
      There were 2 bugs, now fixed by this patch:
      - after deleting an element the len of the dict did not decrease by 1
      - after deleting an element searching through the dict could lead to
        a seg fault due to there being an MP_OBJ_SENTINEL in the ordered array
      9275c182
  9. Feb 08, 2017
    • Damien George's avatar
      py/map: Change mp_uint_t to size_t where appropriate. · af622eb2
      Damien George authored
      The internal map/set functions now use size_t exclusively for computing
      addresses.  size_t is enough to reach all of available memory when
      computing addresses so is the right type to use.  In particular, for
      nanbox builds it saves quite a bit of code size and RAM compared to the
      original use of mp_uint_t (which is 64-bits on nanbox builds).
      af622eb2
  10. May 20, 2016
  11. Apr 15, 2016
    • Damien George's avatar
      py/map: Change hash-table allocation policy to be less aggressive. · 00137b8c
      Damien George authored
      Small hash tables (eg those used in user class instances that only have a
      few members) now only use the minimum amount of memory necessary to hold
      the key/value pairs.  This can reduce performance for instances that have
      many members (because then there are many reallocations/rehashings of the
      table), but helps to conserve memory.
      
      See issue #1760.
      00137b8c
  12. Apr 01, 2016
  13. Dec 31, 2015
  14. Dec 26, 2015
  15. Nov 20, 2015
  16. Nov 19, 2015
    • Damien George's avatar
      py/map: Store key/value in earliest possible slot in hash table. · 593faf14
      Damien George authored
      This change makes the code behave how it was supposed to work when first
      written.  The avail_slot variable is set to the first free slot when
      looking for a key (which would come from deleting an entry).  So it's
      more efficient (for subsequent lookups) to insert a new key into such a
      slot, rather than the very last slot that was searched.
      593faf14
  17. May 12, 2015
    • Damien George's avatar
      py: Convert hash API to use MP_UNARY_OP_HASH instead of ad-hoc function. · c2a4e4ef
      Damien George authored
      Hashing is now done using mp_unary_op function with MP_UNARY_OP_HASH as
      the operator argument.  Hashing for int, str and bytes still go via
      fast-path in mp_unary_op since they are the most common objects which
      need to be hashed.
      
      This lead to quite a bit of code cleanup, and should be more efficient
      if anything.  It saves 176 bytes code space on Thumb2, and 360 bytes on
      x86.
      
      The only loss is that the error message "unhashable type" is now the
      more generic "unsupported type for __hash__".
      c2a4e4ef
  18. Apr 04, 2015
  19. Mar 20, 2015
    • Damien George's avatar
      py: Clarify API for map/set lookup when removing&adding at once. · d1cee027
      Damien George authored
      Addresses issue #1160.
      d1cee027
    • Paul Sokolovsky's avatar
      py: Implement core of OrderedDict type. · 0ef01d0a
      Paul Sokolovsky authored
      Given that there's already support for "fixed table" maps, which are
      essentially ordered maps, the implementation of OrderedDict just extends
      "fixed table" maps by adding an "is ordered" flag and add/remove
      operations, and reuses 95% of objdict code, just making methods tolerant
      to both dict and OrderedDict.
      
      Some things are missing so far, like CPython-compatible repr and comparison.
      
      OrderedDict is Disabled by default; enabled on unix and stmhal ports.
      0ef01d0a
  20. Jan 16, 2015
  21. Jan 01, 2015
  22. Dec 27, 2014
    • Damien George's avatar
      py: Allow to properly disable builtin "set" object. · e37dcaaf
      Damien George authored
      This patch makes MICROPY_PY_BUILTINS_SET compile-time option fully
      disable the builtin set object (when set to 0).  This includes removing
      set constructor/comprehension from the grammar, the compiler and the
      emitters.  Now, enabling set costs 8168 bytes on unix x64, and 3576
      bytes on stmhal.
      e37dcaaf
  23. Nov 27, 2014
  24. Nov 05, 2014
  25. Aug 30, 2014
  26. Jul 03, 2014
  27. Jun 21, 2014
  28. May 03, 2014
    • Damien George's avatar
      Add license header to (almost) all files. · 04b9147e
      Damien George authored
      Blanket wide to all .c and .h files.  Some files originating from ST are
      difficult to deal with (license wise) so it was left out of those.
      
      Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
      04b9147e
  29. Apr 28, 2014
  30. Apr 07, 2014
  31. Apr 06, 2014
    • Damien George's avatar
      py: Revert change to allocation policy for mp_set_t. · c75427ba
      Damien George authored
      Seems that this fixes all set tests.
      c75427ba
    • Paul Sokolovsky's avatar
      py: Fix dict.copy() and low-level map/set allocation. · 5fedd0c3
      Paul Sokolovsky authored
      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).
      5fedd0c3
  32. Apr 05, 2014
Loading