1. 20 Feb, 2018 1 commit
  2. 20 Nov, 2017 1 commit
  3. 12 Nov, 2017 1 commit
  4. 04 Oct, 2017 1 commit
    • 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
  5. 31 Jul, 2017 1 commit
  6. 29 Jun, 2017 1 commit
    • Damien George's avatar
      py/objnamedtuple: Simplify and remove use of alloca building namedtuple. · 265500c5
      Damien George authored
      Prior to this patch there were 2 paths for creating the namedtuple, one for
      when no keyword args were passed, and one when there were keyword args.
      And alloca was used in the keyword-arg path to temporarily create the array
      of elements for the namedtuple, which would then be copied to a
      heap-allocated object (the namedtuple itself).
      
      This patch simplifies the code by combining the no-keyword and keyword
      paths, and removing the need for the alloca by constructing the namedtuple
      on the heap before populating it.
      
      Heap usage in unchanged, stack usage is reduced, use of alloca is removed,
      and code size is not increased and is actually reduced by between 20-30
      bytes for most ports.
      265500c5
  7. 12 Apr, 2017 1 commit
    • Damien George's avatar
      py: Optimise types for common case where type has a single parent type. · 816413e4
      Damien George authored
      The common cases for inheritance are 0 or 1 parent types, for both built-in
      types (eg built-in exceptions) as well as user defined types.  So it makes
      sense to optimise the case of 1 parent type by storing just the type and
      not a tuple of 1 value (that value being the single parent type).
      
      This patch makes such an optimisation.  Even though there is a bit more
      code to handle the two cases (either a single type or a tuple with 2 or
      more values) it helps reduce overall code size because it eliminates the
      need to create a static tuple to hold single parents (eg for the built-in
      exceptions).  It also helps reduce RAM usage for user defined types that
      only derive from a single parent.
      
      Changes in code size (in bytes) due to this patch:
      
          bare-arm:       -16
          minimal (x86): -176
          unix (x86-64): -320
          unix nanbox:   -384
          stmhal:         -64
          cc3200:         -32
          esp8266:       -108
      816413e4
  8. 29 Mar, 2017 1 commit
    • Damien George's avatar
      py: Convert mp_uint_t to size_t for tuple/list accessors. · 6213ad7f
      Damien George authored
      This patch changes mp_uint_t to size_t for the len argument of the
      following public facing C functions:
      
      mp_obj_tuple_get
      mp_obj_list_get
      mp_obj_get_array
      
      These functions take a pointer to the len argument (to be filled in by the
      function) and callers of these functions should update their code so the
      type of len is changed to size_t.  For ports that don't use nan-boxing
      there should be no change in generate code because the size of the type
      remains the same (word sized), and in a lot of cases there won't even be a
      compiler warning if the type remains as mp_uint_t.
      
      The reason for this change is to standardise on the use of size_t for
      variables that count memory (or memory related) sizes/lengths.  It helps
      builds that use nan-boxing.
      6213ad7f
  9. 24 Mar, 2017 1 commit
  10. 17 Oct, 2016 1 commit
  11. 23 May, 2016 1 commit
  12. 14 Mar, 2016 1 commit
  13. 11 Jan, 2016 2 commits
    • Damien George's avatar
      py: Change first arg of type.make_new from mp_obj_t to mp_obj_type_t*. · 5b3f0b7f
      Damien George authored
      The first argument to the type.make_new method is naturally a uPy type,
      and all uses of this argument cast it directly to a pointer to a type
      structure.  So it makes sense to just have it a pointer to a type from
      the very beginning (and a const pointer at that).  This patch makes
      such a change, and removes all unnecessary casting to/from mp_obj_t.
      5b3f0b7f
    • Damien George's avatar
      py: Change type of .make_new and .call args: mp_uint_t becomes size_t. · a0c97814
      Damien George authored
      This patch changes the type signature of .make_new and .call object method
      slots to use size_t for n_args and n_kw (was mp_uint_t.  Makes code more
      efficient when mp_uint_t is larger than a machine word.  Doesn't affect
      ports when size_t and mp_uint_t have the same size.
      a0c97814
  14. 29 Nov, 2015 2 commits
  15. 21 Apr, 2015 1 commit
  16. 16 Apr, 2015 2 commits
    • Damien George's avatar
      044c473d
    • Damien George's avatar
      py: Overhaul and simplify printf/pfenv mechanism. · 7f9d1d6a
      Damien George authored
      Previous to this patch the printing mechanism was a bit of a tangled
      mess.  This patch attempts to consolidate printing into one interface.
      
      All (non-debug) printing now uses the mp_print* family of functions,
      mainly mp_printf.  All these functions take an mp_print_t structure as
      their first argument, and this structure defines the printing backend
      through the "print_strn" function of said structure.
      
      Printing from the uPy core can reach the platform-defined print code via
      two paths: either through mp_sys_stdout_obj (defined pert port) in
      conjunction with mp_stream_write; or through the mp_plat_print structure
      which uses the MP_PLAT_PRINT_STRN macro to define how string are printed
      on the platform.  The former is only used when MICROPY_PY_IO is defined.
      
      With this new scheme printing is generally more efficient (less layers
      to go through, less arguments to pass), and, given an mp_print_t*
      structure, one can call mp_print_str for efficiency instead of
      mp_printf("%s", ...).  Code size is also reduced by around 200 bytes on
      Thumb2 archs.
      7f9d1d6a
  17. 11 Apr, 2015 1 commit
  18. 23 Mar, 2015 1 commit
  19. 22 Mar, 2015 1 commit
  20. 24 Jan, 2015 1 commit
    • stijn's avatar
      py: Fix segfault in namedtuple when name is a non-interned string · 6b636738
      stijn authored
      - namedtuple was wrongly using MP_OBJ_QSTR_VALUE instead of mp_obj_str_get_qstr,
      so when passed a non-interned string it would segfault; fix this by using mp_obj_str_get_qstr
      - store the namedtuple field names as qstrs so it is not needed to use mp_obj_str_get_qstr
      everytime the field name has to be accessed. This also slighty increases performance when
      fetching attributes
      6b636738
  21. 20 Jan, 2015 1 commit
  22. 01 Jan, 2015 6 commits
  23. 10 Dec, 2014 1 commit
  24. 03 Oct, 2014 1 commit
  25. 29 Aug, 2014 1 commit
  26. 24 May, 2014 1 commit
  27. 13 May, 2014 1 commit
  28. 11 May, 2014 1 commit
  29. 10 May, 2014 1 commit
  30. 03 May, 2014 1 commit
    • 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
  31. 02 May, 2014 1 commit
  32. 26 Apr, 2014 1 commit