Skip to content
Snippets Groups Projects
  1. Feb 12, 2019
    • 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. Jul 31, 2017
  3. Mar 30, 2017
  4. Feb 16, 2017
    • Damien George's avatar
      py: Add iter_buf to getiter type method. · ae8d8675
      Damien George authored
      Allows to iterate over the following without allocating on the heap:
      - tuple
      - list
      - string, bytes
      - bytearray, array
      - dict (not dict.keys, dict.values, dict.items)
      - set, frozenset
      
      Allows to call the following without heap memory:
      - all, any, min, max, sum
      
      TODO: still need to allocate stack memory in bytecode for iter_buf.
      ae8d8675
  5. Aug 12, 2016
  6. Jan 11, 2016
    • 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
  7. Nov 29, 2015
    • Damien George's avatar
      py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR. · 999cedb9
      Damien George authored
      This allows the mp_obj_t type to be configured to something other than a
      pointer-sized primitive type.
      
      This patch also includes additional changes to allow the code to compile
      when sizeof(mp_uint_t) != sizeof(void*), such as using size_t instead of
      mp_uint_t, and various casts.
      999cedb9
  8. Jan 20, 2015
  9. Jan 01, 2015
  10. Aug 30, 2014
  11. Aug 29, 2014
  12. May 11, 2014
    • Damien George's avatar
      py: Use mp_arg_check_num in more places. · ee7a880d
      Damien George authored
      Updated functions now do proper checking that n_kw==0, and are simpler
      because they don't have to explicitly raise an exception.  Down side is
      that the error messages no longer include the function name, but that's
      acceptable.
      
      Saves order 300 text bytes on x64 and ARM.
      ee7a880d
  13. 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
  14. May 02, 2014
  15. Apr 17, 2014
  16. Mar 30, 2014
  17. Mar 29, 2014
  18. Mar 26, 2014
  19. Feb 15, 2014
    • Damien George's avatar
      Implement proper exception type hierarchy. · c5966128
      Damien George authored
      Each built-in exception is now a type, with base type BaseException.
      C exceptions are created by passing a pointer to the exception type to
      make an instance of.  When raising an exception from the VM, an
      instance is created automatically if an exception type is raised (as
      opposed to an exception instance).
      
      Exception matching (RT_BINARY_OP_EXCEPTION_MATCH) is now proper.
      
      Handling of parse error changed to match new exceptions.
      
      mp_const_type renamed to mp_type_type for consistency.
      c5966128
    • Damien George's avatar
      Change mp_obj_type_t.name from const char * to qstr. · a71c83a1
      Damien George authored
      Ultimately all static strings should be qstr.  This entry in the type
      structure is only used for printing error messages (to tell the type of
      the bad argument), and printing objects that don't supply a .print method.
      a71c83a1
  20. Feb 12, 2014
  21. Jan 21, 2014
  22. Jan 18, 2014
    • Damien George's avatar
      Make VM stack grow upwards, and so no reversed args arrays. · 20006dbb
      Damien George authored
      Change state layout in VM so the stack starts at state[0] and grows
      upwards.  Locals are at the top end of the state and number downwards.
      This cleans up a lot of the interface connecting the VM to C: now all
      functions that take an array of Micro Python objects are in order (ie no
      longer in reverse).
      
      Also clean up C API with keyword arguments (call_n and call_n_kw
      replaced with single call method that takes keyword arguments).  And now
      make_new takes keyword arguments.
      
      emitnative.c has not yet been changed to comply with the new order of
      stack layout.
      20006dbb
  23. Jan 14, 2014
  24. Jan 13, 2014
Loading