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. Sep 20, 2018
  3. 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
  4. Sep 18, 2017
  5. Sep 17, 2017
    • Paul Sokolovsky's avatar
      py/modbuiltins: Implement abs() by dispatching to MP_UNARY_OP_ABS. · 9dce823c
      Paul Sokolovsky authored
      This allows user classes to implement __abs__ special method, and saves
      code size (104 bytes for x86_64), even though during refactor, an issue
      was fixed and few optimizations were made:
      
      * abs() of minimum (negative) small int value is calculated properly.
      * objint_longlong and objint_mpz avoid allocating new object is the
        argument is already non-negative.
      9dce823c
  6. Aug 29, 2017
  7. Aug 21, 2017
  8. Jul 31, 2017
  9. Jun 15, 2017
  10. Apr 21, 2017
  11. Apr 04, 2017
    • Damien George's avatar
      py: Add very simple but correct hashing for float and complex numbers. · 19f2e47d
      Damien George authored
      Hashing of float and complex numbers that are exact (real) integers should
      return the same integer hash value as hashing the corresponding integer
      value.  Eg hash(1), hash(1.0) and hash(1+0j) should all be the same (this
      is how Python is specified: if x==y then hash(x)==hash(y)).
      
      This patch implements the simplest way of doing float/complex hashing by
      just converting the value to int and returning that value.
      19f2e47d
  12. Mar 29, 2017
  13. Feb 03, 2017
  14. Feb 02, 2017
  15. Oct 17, 2016
  16. 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
  17. 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
  18. Oct 11, 2015
  19. May 17, 2015
  20. May 13, 2015
  21. Apr 16, 2015
    • 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
  22. Apr 11, 2015
  23. Feb 08, 2015
    • Damien George's avatar
      py: Parse big-int/float/imag constants directly in parser. · 7d414a1b
      Damien George authored
      Previous to this patch, a big-int, float or imag constant was interned
      (made into a qstr) and then parsed at runtime to create an object each
      time it was needed.  This is wasteful in RAM and not efficient.  Now,
      these constants are parsed straight away in the parser and turned into
      objects.  This allows constants with large numbers of digits (so
      addresses issue #1103) and takes us a step closer to #722.
      7d414a1b
  24. Feb 02, 2015
  25. Jan 20, 2015
  26. Jan 12, 2015
  27. Jan 01, 2015
  28. Sep 11, 2014
  29. Aug 30, 2014
  30. Aug 29, 2014
  31. Aug 12, 2014
  32. Jun 20, 2014
  33. Jun 01, 2014
    • Damien George's avatar
      Rename bultins config variables to MICROPY_PY_BUILTINS_*. · fb510b3b
      Damien George authored
      This renames:
      MICROPY_PY_FROZENSET -> MICROPY_PY_BUILTINS_FROZENSET
      MICROPY_PY_PROPERTY -> MICROPY_PY_BUILTINS_PROPERTY
      MICROPY_PY_SLICE -> MICROPY_PY_BUILTINS_SLICE
      MICROPY_ENABLE_FLOAT -> MICROPY_PY_BUILTINS_FLOAT
      
      See issue #35 for discussion.
      fb510b3b
  34. May 21, 2014
  35. 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
  36. 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
  37. May 02, 2014
  38. Apr 17, 2014
  39. Apr 11, 2014
Loading